该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
int ungetc ( int character, FILE * stream );
Unget character from stream
将形参character放回到形参stream
A character is virtually put back into an input stream,
一个字符被虚拟地放回输入流中,
decreasing its internal file position
递减内部文件位置,
as if a previous getc operation was undone.
使得好像上一次的getc操作没有做一样.
This character may or may not be
这个字符不一定是
the one read from the stream in the preceding input operation.
之前输入操作到流中读到的
In any case, the next character retrieved from stream
总之, 下一次从流中读到的字符
is the character passed to this function,
是调用本函数(ungetc)时传递的字符,
independently of the original one.
与原来(用户输入)的不相关.
Notice though, that this only affects further input operations on that stream,
但是注意, 这只影响在那个流上的下一步的输入操作,
and not the content of the physical file associated with it,
而不影响相关联的物理文件的内容.
which is not modified by any calls to this function.
也就是任何调用这个函数(ungetc)的行为都不会修改那个文件.
Some library implementations may support this function to be called multiple times,
一些库可能实现了支持这个函数调用多次,
making the characters available in the reverse order in which they were put back.
通过放回, 使得逆序字符成为可能.
Although this behavior has no standard portability guarantees,
尽管这个行为没有标准的可移植保证,
and further calls may simply fail after any number of calls beyond the first.
在调用一次后, 经过任意次数的调用都有可能产生错误.
If successful, the function clears the end-of-file indicator of stream (if it was currently set),
如果成功, 函数会清除流的 文件末尾 标志(如果原来产生了)
and decrements its internal file position indicator if it operates in binary mode;
并且递减它的内部文件位置指示器, 如果它在二进制模式下操作;
In text mode, the position indicator has unspecified value
在文本模式, 位置指示器没有特定的值
until all characters put back with ungetc have been read or discarded.
直到所有用ungetc放回的字符都被读取或丢弃.
A call to fseek, fsetpos or rewind on stream
调用fseek, fsetpos或rewind在该流上,
will discard any characters previously put back into it with this function.
会丢弃任何之前用该函数放回的字符.
If the argument passed for the character parameter is EOF,
如果传递给字符形参的实参是EOF,
the operation fails and the input stream remains unchanged.
这个操作将出错并且输入流保持不变