If you want to find out if there are any keycodes that need to be processed in the keyboard buffer, you can call the check keyboard input function, ki_chk():
|
This function checks the keyboard buffer. If a keycode is in the buffer, it returns its value, but does not remove the keycode from the buffer. If no keycode is in the buffer, ki_chk() returns a zero. It does not wait for a keystroke.
You can use this function to see if a key has been entered without halting operations until a key is entered. In some applications you may wish to check for a keystroke periodically and to continue processing until one needs to be serviced.
Terminal-based systems do not provide a standard means of checking the terminal's keyboard buffer for an available keystroke; thus it is not possible to fully implement the Vermont Views function ki_chk(), or its derivative ki_same(), under terminal-based operating systems. In most uses of the keyboard functions within Vermont Views, the difference from a full implementation of ki_chk() will not be noticeable. See Chapter 54, "Writing Portable Code," for the situations that require caution.