Everything

ungetc


Returns one character to a stream input/output file.

[Format]

#include <stdio.h>

long ungetc (long c, FILE *fp);

[Parameters]

c Character to be returned

fp File pointer

[Return values]

Normal: Returned character

Abnormal: EOF

[Remarks]

The ungetc function returns character c to the stream input/output file indicated by file pointer fp. Unless the fflush, fseek, or rewind function is called, this returned character will be the next input data.

The ungetc function normally returns c, which is the returned character, but returns EOF when an error occurs.

The behavior is not guaranteed when the ungetc function is called more than once without intervening fflush, fseek, or rewind function execution. When the ungetc function is executed, the current file position indicator for that file is moved back one position; however, when this file position indicator has already been positioned at the beginning of the file, its value is not guaranteed.