home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / KBFLUSH.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  763 b   |  36 lines

  1. /**
  2. *
  3. * Name        kbflush -- Discard all keystrokes waiting in the
  4. *               keyboard buffer.
  5. *
  6. * Synopsis    num_found = kbflush();
  7. *
  8. *        int num_found      Number of waiting keystrokes discarded.
  9. *
  10. * Description    This function discards and clears all keystrokes waiting
  11. *        in the BIOS type-ahead buffer.
  12. *
  13. * Returns    num_found      Number of waiting keystrokes discarded.
  14. *
  15. * Version    3.0 (C)Copyright Blaise Computing Inc.    1986
  16. *
  17. **/
  18.  
  19. #include <bkeybd.h>
  20.  
  21. int kbflush()
  22. {
  23.     int  num_found,scan;
  24.     char ch;
  25.  
  26.     num_found = 0;              /* None found yet.          */
  27.  
  28.     while (kbready(&ch,&scan))
  29.     {
  30.     ++num_found;              /* Found a waiting character.   */
  31.     kbin(&scan);              /* Read and discard it.          */
  32.     }
  33.  
  34.     return num_found;
  35. }
  36.