home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / 18 / asctbl1.c next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.6 KB  |  43 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. #include <ctype.h>
  11. #include <stdio.h>
  12.  
  13. main()
  14. {
  15. int i, j, k;
  16.        /* Print table title. */
  17.        printf("\n\n\n                ASCII LOOKUP TABLE\n\n");
  18.  
  19.        /* Print column headers. */
  20.        printf("    ");
  21.        for (i = 0; i < 16; i++) 
  22.                printf("%X  ", i);
  23.        fputchar("\n");
  24.  
  25.        /* Print each line of the table. */
  26.        for ( i = 0, k = 0; i < 16; i++)
  27.                {
  28.                /* Print first hex digit of symbols on this line. */
  29.                printf("%X   ", i);
  30.                /* Print each of the 16 symbols for this line. */
  31.                for (j = 0; j < 16; j++)
  32.                        {
  33.                        /* Filter nonprintable characters. */
  34.                        if ((k >= 7 && k <= 13) || (k >= 28 && k <= 31))
  35.                                printf("   ");
  36.                        else
  37.                                printf("%c  ", k);
  38.                        k++;
  39.                        }
  40.        fputchar("\n");
  41.        }
  42. }
  43.