ungetc()

push character back onto input stream 

Function


SYNOPSIS

#include <stdio.h>

int ungetc(int c, FILE *stream);


DESCRIPTION

The ungetc() function pushes the character specified by integer c, cast to an unsigned char, back onto the input stream pointed to by stream. The end-of-file indicator for stream is cleared, and subsequent reads will get any pushed-back bytes in the reverse order that they were pushed. No actual writes, however, are performed to the file or other underlying storage of stream.

A successful call to a file-positioning function for stream, such as fsetpos() or rewind(), discards any pushed back bytes for the stream.

The pushback buffer is limited. Repeated calls to ungetc() with no intervening read or file positioning operations fail.


PARAMETERS

c 

Is the character to push back onto stream.

stream 

Points to the input stream.


RETURN VALUES

If successful, the ungetc() function returns the character pushed back after conversion. On failure, ungetc() returns an EOF.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
fputc(), fsetpos(), rewind()


PTC MKS Toolkit 10.2 Documentation Build 28.