KBDCHAR(3R)

NAME
kbdchar - read character from keyboard

SYNOPSIS
int kbdchar ( )

DESCRIPTION
The kbdchar function returns the next keyboard character typed to the process. If no characters have been typed, kbdchar returns -1. If KBD has not been requested, kbdchar will always return -1, even if characters have been typed to the process.

EXAMPLE
This code will prevent a program from exiting until the 'q' character has been typed on the keyboard.

    #include <dmd.h>
    main( )
    {
         request (KBD);
         .
         .
         .
         do
              wait(KBD);
         while( kbdchar ( ) != 'q' );
    }

SEE ALSO
resources(3R).

WARNING
Since the keyboard routine is a process, you must release the CPU in order to have typed characters placed on the application's keyboard queue.