uTools-Manuals/docs/c/kbhit.html

41 lines
837 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1>输入输出 - kbhit</h1>
<p>原型extern int kbhit(void);</p>
<p>用法:#include &lt;stdio.h></p>
<p>功能:检测按键</p>
<p>说明:检测键盘是否有键按下。</p>
如果有键按下,则返回对应键值;否则返回零。
kbhit不等待键盘按键。无论有无按键都会立即返回。
举例:<pre><code class="language-c">
// kbhit.c
#include &lt;stdio.h>
main()
{
int i=0;
clrscr();
while(!kbhit())
{
clrscr();
printf("%05d",i++);
}
clrscr();
printf("End.");
getchar();
return 0;
}
</code></pre>相关函数:<font color=gray>getkey,getch</font>,<a href="getchar.html">getchar</a>