C Programming Tutorial
In the C Programming Language, the ungetc function puts a character back onto the stream pointed to by stream and clears the end-of-file indicator for stream.
Syntax
The syntax for the ungetc function in the C Language is:
int ungetc(int c, FILE *stream);
c
The character to put back onto the stream.
stream
The stream to modify.
Returns
The ungetc function returns the character that is put back. If an error occurs because too many attempts are made to put back characters without a read or file positioning operation, the ungetc function will return EOF.
Required Header
In the C Language, the required header for the ungetc function is:
#include <stdio.h>
Applies To
In the C Language, the ungetc function can be used in the following versions:
- ANSI/ISO 9899-1990