|
|
#include <stdio.h>int ungetc (c, stream) int c; FILE *stream;
One character of pushback is guaranteed. If the ungetc function is called too many times on the same stream without an intervening read or file-positioning operation on that stream, the operation may fail.
If the value of c equals that of the macro EOF, the operation fails and the input stream is unchanged.
A successful call to the ungetc function clears the end-of-file indicator for the stream. The value of the file-position indicator for the stream after reading or discarding all pushed-back characters is the same as it was before the characters were pushed back. One character of pushback is guaranteed, provided something has already been read from the stream and the stream is actually buffered. In the case that stream is stdin, and the stream is buffered, one character may be pushed back onto the buffer without a previous read statement. For a stream, the value of its file-position indicator after a successful call to the ungetc function is unspecified until all pushed-back characters are read or discarded.
X/Open Portability Guide, Issue 3, 1989
;
ANSI X3.159-1989 Programming Language -- C
;
Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2)
;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
;
and
NIST FIPS 151-1
.