
------------------------------------------------------------------------------
6.29 Put a character into a steam. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ungetc
[Syntax]
#include <stdio.h>
int ungetc( int c, FILE *stream ) ;
[Arguments]
c Character to be pushed.
stream Pointer to a FILE structure.
[Return]
Returns a character "c" if successful. Returns EOF if nothing has
been read from the stream or the specified character has not be able
to pushed into the stream.
[Description]
Pushes a character "c" into the stream and clears the end of file
indicator. The stream must be opened with "Read mode". The next
reading from the stream is processed from "c". If "c" is EOF, it is
ignored. The pushed character into the stream will be cleared befer
it is read from the stream by calling "fflush", "fseek", "fsetpos"
or "rewind" functions. The file position indicator is not changed by
this function. If "ungetc" function is used for any text stream, the
file pointer is undefined until all pushed characters are read or
cleared. If "ungetc" function is used for any binary stream, the
file point indicator is set to the previous position. In the case
that the value of the file point indicator was zero before calling
this function, the value after calling is not warranted. When
"ungetc" function is calling twice continuously without any reading,
the result is unstable. After calling of "fscanf" function, "ungetc"
function will be unsuccessful unless one more reading procedure.
(Because "fscanf" function calls "ungetc" function itself.)