home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / 18 / asctbl2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.6 KB  |  44 lines

  1. /*************************************************************************
  2.  *                                                                       *
  3.  *  ASCTBL.C                                                             *
  4.  *   This program generates an ASCII lookup table for all displayable    *
  5.  *   ASCII and extended IBM PC codes, leaving blanks for nondisplayable  *
  6.  *   codes.                                                              *
  7.  *                                                                       *
  8.  ************************************************************************/
  9.  
  10. #define LINT_ARGS
  11. #include <ctype.h>
  12. #include <stdio.h>
  13.  
  14. main()
  15. {
  16. int i, j, k;
  17.         /* Print table title. */
  18.         printf("\n\n\n                ASCII LOOKUP TABLE\n\n");
  19.  
  20.         /* Print column headers. */
  21.         printf("    ");
  22.         for (i = 0; i < 16; i++) 
  23.                 printf("%X  ", i);
  24.         fputchar('\n');
  25.  
  26.         /* Print each line of the table. */
  27.         for ( i = 0, k = 0; i < 16; i++)
  28.                 {
  29.                 /* Print first hex digit of symbols on this line. */
  30.                 printf("%X   ", i);
  31.                 /* Print each of the 16 symbols for this line. */
  32.                 for (j = 0; j < 16; j++)
  33.                         {
  34.                         /* Filter nonprintable characters. */
  35.                         if ((k >= 7 && k <= 13) || (k >= 28 && k <= 31))
  36.                                 printf("   ");
  37.                         else
  38.                                 printf("%c  ", k);
  39.                         k++;
  40.                         }
  41.                 fputchar('\n');
  42.                 }
  43. }
  44.