ungetc(3S) SDK R4.11 ungetc(3S)
NAME
ungetc - push character back onto input stream
SYNOPSIS
#include <stdio.h>
int ungetc (int c, FILE *stream);
DESCRIPTION
ungetc inserts the character specified by c (converted to an unsigned
char) into the buffer associated with an input stream [see intro(3)].
That character, c, will be returned by the next getc(3S) call on that
stream. ungetc returns c, and leaves the file corresponding to
stream unchanged. A successful call to ungetc clears the EOF
indicator for stream.
The value of the file position indicator for stream after reading or
discarding all pushed-back characters will be the same as it was
before the characters were pushed back.
If c equals EOF, ungetc does nothing to the buffer and returns EOF.
fseek, rewind [both described on fseek(3S)], and fsetpos erase the
memory of inserted characters for the stream on which they are
applied.
Errors
ungetc returns EOF if it cannot insert the character.
Considerations for Threads Programming
+---------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+---------+-----------------------------+
|ungetc | Y Y N |
+---------+-----------------------------+
REFERENCES
reentrant(3), fsetpos(3C), fseek(3S), getc(3S), setbuf(3S), stdio(3S)
Licensed material--property of copyright holder(s)