home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / R_LA4_01.ZIP / KBDTEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-11-29  |  631 b   |  19 lines

  1. /*KBDTEST.C - Prints code of extended char set (F keys, Arrow, etc.).*/
  2. /* From the book "Microsoft C Programming for the IBM" by Robert     */
  3. /* Lafore, page 253.                                                 */
  4. /*********************************************************************/
  5.  
  6. main()
  7. {
  8. char key, key2;
  9.  
  10.    while((key = getch()) != 'X')
  11.       if (key == 0) {                     /* If extended code */
  12.          key2 = getch();                  /* Read second code */
  13.          printf("%4d, %4d\n", key, key2);
  14.       }
  15.       else
  16.          printf("%4d, %12c\n", key, key);      /* Not extended code */
  17. }
  18.  
  19.