mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-10-14 14:01:24 +08:00
适配新版,更新uToolsAPI文档
This commit is contained in:
33
src/docs/c/getchar.html
Normal file
33
src/docs/c/getchar.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<h1>输入输出 - getchar</h1>
|
||||
|
||||
|
||||
<p>原型:extern int getchar(void);</p>
|
||||
|
||||
<p>用法:#include <ctype.h></p>
|
||||
|
||||
<p>功能:读键</p>
|
||||
|
||||
<p>说明:从键盘上读取一个键,并返回该键的键值</p>
|
||||
getch是到getchar的宏定义
|
||||
|
||||
举例:<pre><code class="language-c">
|
||||
|
||||
// getchar.c
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
int c;
|
||||
|
||||
clrscr();
|
||||
printf("Press key...");
|
||||
while((c=getchar())!='Q')
|
||||
{
|
||||
clrscr();
|
||||
printf("key: %c\nvalue: %x",c,c);
|
||||
}
|
||||
}
|
||||
|
||||
</code></pre>相关函数:<font color=gray>getkey</font>,<a href="kbhit.html">kbhit</a>
|
||||
|
Reference in New Issue
Block a user