ungetc

Pushes a character back into the input stream and leaves the stream positioned before the character.

Format

#include  <stdio.h>

int ungetc  (int character, FILE *file_ptr);

Arguments

character
A value of type int.
file_ptr
A file pointer.

Description

When using this function, the character is pushed back onto the file indicated by file_ptr.

One pushback 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 in this section.

Return Values
The push-back character. 
EOF  Indicates it cannot push the character back. 


Previous Page | Next Page | Table of Contents | Index