home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / Editors / mjovesrc.zoo / testkey.c < prev    next >
C/C++ Source or Header  |  1992-04-04  |  524b  |  40 lines

  1. #include <osbind.h>
  2. #include <stdio.h>
  3.  
  4. #ifndef FALSE
  5. #define FALSE 0
  6. #define TRUE !FALSE
  7. #endif
  8.  
  9. bgetkey(int *speckey)
  10. {
  11.     union scancode {
  12.         long    scan;
  13.         short    scarray[2];
  14.     } sc;
  15.  
  16.     sc.scan = Bconin(2);
  17.     if (sc.scarray[1]) {
  18.         *speckey = FALSE;
  19.         return (sc.scarray[1]);
  20.     }
  21.     else {
  22.         *speckey = TRUE;
  23.         return (sc.scarray[0]);
  24.     }
  25. }
  26.  
  27. main()
  28. {
  29.     int special;
  30.     unsigned char c;
  31.  
  32.     do {
  33.         c = bgetkey(&special);
  34.         if (!special)
  35.             printf("Regular Key: %c\n", c);
  36.         else
  37.             printf("Special Key: 0x%x\n", c);
  38.     } while (c != 'q');
  39. }
  40.