|
|
|
7.19.7.11 The ungetc function Synopsis 1 #include <stdio.h> int ungetc(int c, FILE *stream); Description 2 The ungetc function pushes the character specified by c (converted to an unsigned char ) back onto the input stream pointed to by stream . Pushed-back characters will be returned by subsequent reads on that stream in the reverse order of their pushing. A stream ) to a file positioning function ( fseek , fsetpos , or rewind ) discards any pushed-back characters for the stream. The external storage corresponding to the stream is unchanged. 3 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 4 If the value of c equals that of the macro EOF , the operation fails and the input stream is unchanged. 5 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 ungetc function is unspecified until all pushed-back characters are read or discarded. For a binary stream, its file position indicator is decremented by each successful call to ungetc function; if its value was zero before a call, it is indeterminate after the call. 256) Returns 6 The ungetc function returns the character pushed back after conversion, or EOF if the operation fails. Forward references: file positioning functions (7.19.9). 256) See ‘‘future library directions’’ (7.26.9). 300 Library §7.19.7.11 |