When using the ungetc function, the character is pushed back onto the file indicated by file_ptr. One push-back is guaranteed, even if there has been no previous activity on the file. The fseek function erases all memory of pushed-back characters. The pushed-back character is not written to the underlying file. If the character to be pushed back is EOF, the operation fails, the input stream is left unchanged, and EOF is returned. See also fseek and getc.