user-0 提问: "void __cdecl ungetch(int)" (?ungetch@@YAXH@Z)

回复:
user: user-0
content: 我的不是ungetch()么，怎么变成ungetc（）了，今天试了一下又没有这个错误了。。。

user: user-1
content: GETS Section: Linux Programmer's Manual (3 ) Updated: 1993-04-04  --------------------------------------------------------------------------------    NAME fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings    SYNOPSIS #include <stdio.h>  int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream);     DESCRIPTION fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error.  getc() is equivalent to fgetc() except that it may be implemented as a macro which evaluates stream more than once.   getchar() is equivalent to getc(stdin).   gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with '\0'. No check for buffer overrun is performed (see BUGS below).   fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer.   ungetc() pushes c back to stream, cast to unsigned char, where it is available for subsequent read operations. Pushed - back characters will be returned in reverse order; only one pushback is guaranteed.   Calls to the functions described here can be mixed with each other and with calls to other input functions from the stdio library for the same input stream.   For non-locking counterparts, see unlocked_stdio(3).     RETURN VALUE fgetc(), getc() and getchar() return the character read as an unsigned char cast to an int or EOF on end of file or error.  gets() and fgets() return s on success, and NULL on error or when end of file occurs while no characters have been read.   ungetc() returns c on success, or EOF on error.     CONFORMING TO ANSI - C, POSIX.1. LSB deprecates gets().    BUGS Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead.  It is not advisable to mix calls to input functions from the stdio library with low - level calls to read() for the file descriptor associated with the input stream; the results will be undefined and very probably not what you want.     SEE ALSO read(2), write(2), ferror(3), fopen(3), fread(3), fseek(3), puts(3), scanf(3), unlocked_stdio(3)  --------------------------------------------------------------------------------

user: user-2
content: 第一，C标准库中没这个程序； 第二，不要在.cpp文件中写C的代码，在你搞清楚C++ name mangle是什么东西之前。

user: user-3
content: void ungetch(int); 这个函数你声明了，但没有实现，如果是要使用标准库中的同名函数，去掉这个声明  VS建议使用_ungetch  用法参看：https://msdn.microsoft.com/zh-cn/library/yezzac74.aspx

user: user-4
content: ungetc缺少参数 int ungetc(int c, FILE *stream);

user: user-5
content: ungetch的功能是把一个字符退回到键盘缓冲区中。 在较高版本的一些Visual Studio编译器中（如vs2015），ungetch 被认为是不安全的，应当该使用 _ungetch 代替 ungetch   摘自百度百科， 可能是基础库里移除了改函数的实现，但却能找到这个函数的定义，不知道是不是bug _ungetch这个没找到到，到是找到_ungettch， 效果我没试，你可以试试效果对不对

user: user-1
content: ungetc(*w,stdin);

user: user-1
content: 将你的源代码扩展名由.cpp改为.c

user: user-1
content: int ungetc(int c, FILE *stream);