01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

UNGETC ( 3S ) UNGETC ( 3S )<br />

NAME<br />

ungetc - push character back into input stream<br />

SYNOPSIS<br />

#include <br />

int ungetc (c, stream)<br />

char c;<br />

FILE •stream;<br />

DESCRIPTION<br />

Ungetc inserts the character c into the buffer associated with an<br />

input stream . That character, c, will be returned by the next<br />

getc call on that stream. Ungetc returns c, and leaves the file<br />

stream unchanged.<br />

One character of pushback is guaranteed provided something has<br />

been read from the stream and the stream is actually buffered.<br />

If c equals EOF, ungetc does nothing to the buffer and returns<br />

EOF.<br />

Fseek(3S) erases all memory of inserted characters.<br />

SEE ALSO<br />

fseek(3S), getc(3S), setbuf(3S).<br />

DIAGNOSTICS<br />

In order that ungetc perform correctly, a read statement must<br />

have been performed prior to the call of the ungetc function.<br />

Ungetc returns EOF if it can't insert the character. In the case<br />

that stream is stdin , ungetc will allow exactly one character to be<br />

pushed back onto the buffer without a previous read statement.<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!