(ANSI Standard)
#include <stdio.h> ret = ungetc( c, fp );
"ungetc" pushes a character back into an input stream. The next "getc" to that stream will return the character that was pushed back.
You can only push back characters into a stream if something has already been read from that stream and if the input from the stream is buffered. Trying to push back several characters in succession may or may not work; it will be highly machine dependent. "ungetc" will not attempt to push back the EOF character.
A side effect of the "fseek" function is that all memory of pushed back characters is lost.
Copyright © 1996, Thinkage Ltd.