最佳答案:
ungetch的功能是把一个字符退回到键盘缓冲区中。
详情介绍
ungetch的功能是把一个字符退回到键盘缓冲区中。

在较高版本的一些Visual Studio编译器中(如vs2015),ungetch 被认为是不安全的,应当该使用 _ungetch 代替 ungetch 。

- 中文名
- ungetch
- 性质
- 函数名
- 用 法:
- int ungetch(int c);
- 领域
- 编程
函数名: ungetch
用 法:int ungetch(int c);
程序例:
#include <stdio.h>#include <conio.h>#include <ctype.h>int main( void ){ int i=0; char ch; puts("Input an integer followed by a char:"); while((ch = getch()) != EOF && isdigit(ch)) i = 10 * i + ch - 48; if (ch != EOF) ungetch(ch); printf("nni = %d, next char in buffer = %cn", i, getch()); return 0;}

