I'm writing an application using C language, in which
I have a while loop that run infinitely, only stop if
user hit 'q'on the keyboard.
Does Linux C library has a function to detect keyboard
hit (like function _kbhit in Windows)?
While(1)
{
/* if user hit q */
if( _kbhit() ) /* this is Windows function,
how about in Linux? */
{ /* Check for "q" to Quit */
if( getchar()=='q')
{ exit (1)}
}
/* do something ...... */
}
if there's no such a function in lib, how do you write
it to do the same thing?
Thanks.
-Shannon-
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/