home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / WATCOM_C / WAT18.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-14  |  884 b   |  33 lines

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat18.c                                              */
  3. /*------------------------------------------------------------------*/
  4. #include <stdio.h>
  5. #include <bios.h>
  6. #include <ctype.h>
  7.  
  8. #define SCROLL  0x10
  9. #define NUMLOCK 0x20
  10. #define CAPS    0x40
  11. #define INS     0x80
  12.  
  13. void main()
  14. {
  15.  unsigned key_state, modifiers;
  16.  key_state = _bios_keybrd(_KEYBRD_READ);
  17.  modifiers = _bios_keybrd(_KEYBRD_SHIFTSTATUS);
  18.  if(modifiers)
  19.  {
  20.   printf("\n[ ");
  21.   if(modifiers & SCROLL)  printf("SCROLL LOCK ┴Σ ");
  22.   if(modifiers & NUMLOCK) printf("NUM LOCK ┴Σ ");
  23.   if(modifiers & CAPS)    printf("CAPS LOCK ┴Σ ");
  24.   if(modifiers & INS)     printf("INSERT ┴Σ ");
  25.   printf("]\n");
  26.  }
  27.  if(isalnum(key_state & 0xFF))
  28.    printf("'%c'\n",key_state);
  29.  else
  30.    printf("%#02x\n",key_state);
  31. }
  32.  
  33.