Clib Unget Method

The Clib Unget method pushes a character back into a file. It returns one of the following values:

  • If successful, then it returns the value that the char argument contains.

  • If not successful, then it returns the following value:

    EOF

If this method pushes a character back into a file, then it converts the character that you specify in the char argument to a byte. It only pushes back one character. After the unget, this character is again available in the file for subsequent retrieval. You might need to use this method to read up to, but not including, a newline character. You can then use it to push the newline character back into the file buffer.

Format

Clib.ungetc(char, filePointer)

The following table describes the arguments for the Clib Unget method.

Argument Description

char

The character that this method pushes back. It puts back one character to the file stream that it reads. It moves the seek position of the file pointer by one character position.

filePointer

A file pointer that the Clib Open File method returns.