c语言中getc getch getchar 的区别
getc():调用方式:int getc(FILE *stream)它返回指定输入流stream的当前位置的下一个字符,并增加文件的位置指示器.例如:1 #include 2 #include //此头文件中包含了linux定义的常用常量 3 int main(int argv,char args[]) 4 { 5 char ch; 6 whi
·
getc():
调用方式:int getc(FILE *stream)
它返回指定输入流stream的当前位置的下一个字符,并增加文件的位置指示器.
例如:1 #include
2 #include //此头文件中包含了linux定义的常用常量
3 int main(int argv,char args[])
4 {
5 char ch;
6 while((ch = getc(stdin))!='a')
7 {
8 putc(ch,stdout);
9 }
10 }
~
getch():
调用方式:int getch(void)
getch()从控制台读取一个字符,但不把该字符显示在屏幕上,也就是不回显.
getchar():
调有方式:int getchar(void)
getchar()从控制台读取一个字符,并回显,它和getch(),getche()的不同在于,它等到输入一个回车才结束,就算你输入了一个字符串,它也只取其中的第一个字符.(getchar是getc的宏定义)
<script>window._bd_share_config={"common":{"bdsnskey":{},"bdtext":"","bdmini":"2","bdminilist":false,"bdpic":"","bdstyle":"0","bdsize":"16"},"share":{}};with(document)0[(getelementsbytagname('head')[0]||body).appendchild(createelement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new date()/36e5)];</script>
阅读(1588) | 评论(0) | 转发(2) |
相关热门文章
给主人留下些什么吧!~~
评论热议
更多推荐



所有评论(0)