Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ungetc(3S) — HP-UX 9.10

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fseek(3S)

fsetpos(3S)

getc(3S)

setbuf(3S)

ungetc(3S)

NAME

ungetc() − push character back into input stream

SYNOPSIS

#include <stdio.h>

int ungetc(int c, FILE *stream);

DESCRIPTION

ungetc() inserts the character c (converted to an unsigned char) into the buffer associated with an input stream. That character, c, is returned by the next call to getc() (see getc(3S)) on that stream. A successful intervening call to a file positioning function with stream (fseek(), fsetpos(), or rewind()) erases all memory of the inserted characters. 

ungetc() affects only the buffer associated with the input stream. It does not affect the contents of the file corresponding to stream.

One character of pushback is guaranteed. 

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

RETURN VALUE

If successful, ungetc() returns c and clears the end-of-file indicator for the stream.  ungetc() returns EOF if it cannot insert the character. 

SEE ALSO

fseek(3S), fsetpos(3S), getc(3S), setbuf(3S). 

STANDARDS CONFORMANCE

ungetc(): AES, SVID2, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Hewlett-Packard Company  —  HP-UX Release 9.10: April 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026