KBHIT(DOS) XENIX System V KBHIT(DOS)
Name
kbhit - Checks the console for a keystroke.
Syntax
#include <conio.h>
int kbhit ( );
Description
The kbhit function checks the console for a recent
keystroke.
Return Value
kbhit returns a nonzero value if a key has been pressed.
Otherwise, it returns zero.
Example
#include <conio.h>
int result;
/* The following statement tests to see if a key has ** been
hit. */
result = kbhit ( );
/* If result is nonzero, a keystroke is waiting in the **
buffer. It can be fetched with getch or getche. ** If getch
or getche were called without first checking ** kbhit, the
program might pause while waiting for ** input. */
Notes
This call must be compiled with the -dos flag.
Page 1 (printed 8/7/87)