Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <conio.h>
    int kbhit( void );

Description:
    The kbhit function tests whether or not a keystroke is currently
    available.  When one is available, the function  getch or  getche may be
    used to obtain the keystroke in question.

    With a stand-alone program, the kbhit function may be called
    continuously until a keystroke is available.

Returns:
    The kbhit function returns zero when no keystroke is available;
    otherwise, a non-zero value is returned.

Example:
    /*
     * This program loops until a key is pressed
     * or a count is exceeded.
     */
    #include <stdio.h>
    #include <conio.h>

    void main()
      {
        unsigned long i;

        printf( "Program looping. Press any key.\n" );
        for( i = 0; i < 10000; i++ ) {
          if( kbhit() ) {
            getch();
            break;
          }
        }
      }

Classification:
    WATCOM

Systems:
    All, Netware

See Also:
    getch, getche, putch, ungetch

See Also: getch getche

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson