ungetc
- Updated2023-02-21
- 1 minute(s) read
ungetc
int ungetc (int character, FILE *stream);
Purpose
Will push a single character back into the specified input stream. Subsequent reads on that stream will return pushed-back characters in the reverse order of their pushing. A successful intervening call to fseek, fsetpos, or rewind will discard any characters pushed back into the stream by this function.
![]() |
Note This function can only be called up to 6 times on the same stream without an intervening read or file positioning operation on that stream. |
Parameters
Input | ||
Name | Type | Description |
character | int | Contains the character that is pushed back into the specified input stream. The input must be a character with integer value between 0 and 255. |
stream | FILE * | Contains a pointer to the input stream where the specified character is pushed back. |
Return Value
Name | Type | Description |
characterPushed | int | Contains the character pushed back into the specified input stream. If an error occurs, ungetc returns EOF and sets errno to a nonzero value. |
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later