home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / KBHIT.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.5 KB  |  45 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - kbhit.cas
  3.  *
  4.  * function(s)
  5.  *        kbhit - checks for recent keystrokes
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*[]------------------------------------------------------------[]*/
  9. /*|                                                              |*/
  10. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  11. /*|                                                              |*/
  12. /*|                                                              |*/
  13. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  14. /*|     All Rights Reserved.                                     |*/
  15. /*|                                                              |*/
  16. /*[]------------------------------------------------------------[]*/
  17.  
  18. #pragma inline
  19. #include <conio.h>
  20.  
  21. /*-----------------------------------------------------------------------*
  22.  
  23. Name        kbhit - checks for recent keystrokes
  24.  
  25. Usage        int kbhit(void);
  26.  
  27. Prototype in    conio.h
  28.  
  29. Description    kbhit checks to see if a keystroke is currently
  30.         available. Any available keystrokes can be retrieved with
  31.         getch or getche.
  32.  
  33. Return value    If a keystroke is available, kbhit returns a
  34.         non-zero integer. If not, it returns 0.
  35.  
  36. *------------------------------------------------------------------------*/
  37. int kbhit( void )
  38.   {
  39.   asm     mov     ah, 0Bh
  40.   asm     int     21h
  41.   asm     cbw
  42.  
  43.   return( _AX );
  44.   }
  45.