


      UNGETC(3S)                  (UNIX 5.0)                 UNGETC(3S)



      NAME
           ungetc - push character back into input stream

      SYNTAX
           #include <stdio.h>

           int ungetc (c, stream)
           char c;
           FILE *stream;

      DESCRIPTION
           Ungetc inserts the character c into the buffer associated
           with an input stream.  That character, c, will be returned
           by the next getc call on that stream.  Ungetc returns c, and
           leaves the file stream unchanged.

           One character of pushback is guaranteed provided something
           has been read from the stream and the stream is actually
           buffered.

           If c equals EOF, ungetc does nothing to the buffer and
           returns EOF.

           Fseek(3S) erases all memory of inserted characters.

      SEE ALSO
           fseek(3S), getc(3S), setbuf(3S).

      DIAGNOSTICS
           In order that ungetc perform correctly, a read statement
           must have been performed prior to the call of the ungetc
           function.  Ungetc returns EOF if it can't insert the
           character.  In the case that stream is stdin, ungetc will
           allow exactly one character to be pushed back onto the
           buffer without a previous read statement.




















      Page 1                                         (73 A2 02MTA REV1)



