| ungetc | Function (Macro)

stdio.h

short ungetc (short c, FILE *stream);

Pushes a character back into input stream.

ungetc pushes the character c back onto the stream associated with the structure pointed to by stream. This character will be returned on the next call to getc (or related functions like fread) for that stream. A second call to ungetc without a call to getc will force the previous character to be forgotten. A call to fflush, fseek, fsetpos, or rewind erases all memory of any pushed-back characters. ungetc returns the character pushed back. ANSI C proposes that it need to return EOF if the operation fails, but in this implementation it cannot fail. It is implemented as a very simple macro.
Note: ungetc is used in some programs to push back a character to the stream associated with the keyboard using `ungetc(c, stdin)`. This is not possible on TI, because terminal-associated streams are not supported. Use pushkey instead to achieve the same effect.