求教导getc(),getchar(),getch()区别!大神来啊!
c语言吧
全部回复
仅看楼主
level 7
si道 楼主
(抓狂)
2012年11月29日 01点11分 1
level 7
si道 楼主
还有个
getche()函数!
2012年11月29日 01点11分 2
level 11
<stdio.h> :: int getchar(void), int getc(FILE *stream) 标准库
<curses.h> :: int getch(void) 平台相关 (win下在conie.h中?)
2012年11月29日 01点11分 3
那是不我gcc下 int getch(void)没有用啊!
2012年11月29日 02点11分
回复 si道 :无关gcc,mingw也能写win32 Application
2012年11月29日 03点11分
回复 si道 :只要你包含了头文件(没有也能自己写......),链接上那个库就行了
2012年11月29日 03点11分
回复 iyzsong :我gcc还真没有这文件,在同学那完美的很
2012年11月29日 08点11分
level 12
只是知道getchar()和getch()是缓存/非缓存输入
2012年11月29日 02点11分 4
level 7
还有一个gets
2012年11月29日 02点11分 5
这个是字符串很好理解
2012年11月29日 08点11分
level 7
gets是字符串的……
2012年11月29日 02点11分 6
level 7
getch窗口不显示你输入的,getche显示,二者都不需要回车。
2012年11月29日 04点11分 7
两个在一个头文件下吗
2012年11月29日 08点11分
level 11
getchar = getc(stdin)
getc = fgetc
2012年11月29日 08点11分 8
c标准库中没有getch.
2012年11月29日 08点11分
回复 Hope_20121221_ :标准的没吗,难怪我电脑不行
2012年11月29日 09点11分
不过有很多终端图形库提供了getch来接受输入字符(不回显), 比如curses和win下的conio.h
2012年11月29日 09点11分
level 10
getch getche都不是标准c的函数 他们是非缓冲输入 后者有回显 e代表echo
2012年11月29日 10点11分 9
level 12
getc(FILE *stream)从stream所指的文件中读取一个字符
getchar由标准输入设备内读取一字符
2012年11月29日 11点11分 10
getc()也可以读键盘东东,这是为什么呢?
2012年11月29日 11点11分
回复@si道 :getc(stdin),stdin也是一个stream
2012年11月29日 11点11分
回复@si道 :msdn:FILE *stdin
2012年11月29日 11点11分
1