回复 7楼 诸葛欧阳
函数名:kbhit()(VC++6.0下为_kbhit())功 能及返回值: 检查当前是否有键盘输入,若有则返回一个非0值,否则返回0
从前风闻有你,现在我亲眼看见你
// crt_kbhit.c // compile with: /c /* This program loops until the user * presses a key. If _kbhit returns nonzero, a * keystroke is waiting in the buffer. The program * can call _getch or _getche to get the keystroke. */ #include <conio.h> #include <stdio.h> int main( void ) { /* Display message until key is pressed. */ while( !_kbhit() ) _cputs( "Hit me!! " ); /* Use _getch to throw key away. */ printf( "\nKey struck was '%c'\n", _getch() ); }