VMS Help  —  CRTL  ungetc
    Pushes a character back into the input stream and leaves the
    stream positioned before the character.

    Format

      #include  <stdio.h>

      int ungetc  (int character, FILE *file_ptr);

1  –  Arguments

 character

    A value of type int.

 file_ptr

    A file pointer.

2  –  Description

    When using the ungetc function, the character is pushed back onto
    the file indicated by file_ptr.

    One push-back is guaranteed, even if there has been no previous
    activity on the file. The fseek function erases all memory of
    pushed-back characters. The pushed-back character is not written
    to the underlying file. If the character to be pushed back is
    EOF, the operation fails, the input stream is left unchanged, and
    EOF is returned.

    See also fseek and getc.

3  –  Return Values

    x                  The push-back character.
    EOF                Indicates it cannot push the character back.
Close Help