home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 181_01 / _kbdfly.doc next >
Text File  |  1985-12-15  |  2KB  |  39 lines

  1.         title     _kbdfly - C replacement for BASIC's INKEY$
  2. ;------------------------------------------------------------------------------;
  3. ;  This program gives C a replacement for BASIC's INKEY$ statement.
  4. ;  It's needed is because the extended keyboard characters
  5. ;  such as PgUp, Home, etc. return 'unusual' information from the DOS 
  6. ;  interrupt.  If the first character returned from certain DOS functions is
  7. ;  a zero and the zero flag indicates that it is a valid character, then
  8. ;  this means that a second interrupt needs to be performed to retrieve the
  9. ;  extended code.  Then the extended code must be communicated back to the
  10. ;  caller separately from a normal code because the decimal value of some
  11. ;  extended codes matches that of normal letters, e.g. Home key returns a
  12. ;  decimal 71, which is also the capital G.  The Home key returns the
  13. ;  value on the second interrupt, where the G comes on the first.  This
  14. ;  is similar to having to test the length of INKEY$'s returned string in
  15. ;
  16. ;  Also like INKEY$, if no character is present from the keyboard, control
  17. ;  returns anyway and a zero is present as the returned value.
  18. ;
  19. ;  Sample invocation from C is:
  20. ;
  21. ;  extern char kbdfly();
  22. ;  char extended_char;
  23. ;  char waiting_char;
  24. ;
  25. ;  waiting_char = kbdfly( &extended_char );
  26. ;  if ( waiting_char )
  27. ;     /* regular character was returned */
  28. ;  else {
  29. ;     if ( extended_char )
  30. ;        /* extended character was returned */
  31. ;     else
  32. ;        /* no character was returned */
  33. ;  }
  34. ;
  35. ;------------------------------------------------------------------------------;
  36. ;  George Defenbaugh  10034 E. 29th St.  Tulsa, OK  74129  918-622-7926
  37. ;  12/15/1985
  38. ;------------------------------------------------------------------------------;
  39.