HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
u
ungetc(3S) ungetc(3S)
NAME
ungetc() - push character back into input stream
SYNOPSIS
#include <stdio.h>
int ungetc(int c, FILE *stream);
Obsolescent Interface
int ungetc_unlocked(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 suc-
cessful intervening call to a file positioning function with stream (fseek(), fsetpos(),orrewind())
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.
Obsolescent Interface
ungetc_unlocked() pushes character back into input stream.
APPLICATION USAGE
ungetc() is a thread-safe interface. It is not async-cancel-safe. A cancellation point may occur when a
thread is executing ungetc().
After ungetc() is applied to a stream, the stream becomes byte-oriented (see orientation(5)).
RETURN VALUE
If successful,
ungetc() and ungetc_unlocked()
return c and clear the end-of-file indicator for the
stream.
ungetc() and ungetc_unlocked()
return EOF if they cannot insert the character.
WARNINGS
ungetc_unlocked() is an obsolescent interface supported only for compatibility with existing DCE
applications. New multithreaded applications should use
ungetc().
SEE ALSO
flockfile(3S), fseek(3S), fgetpos(3S), getc(3S), setbuf(3S), orientation(5).
STANDARDS CONFORMANCE
ungetc(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
Section 3−−994 − 1 − HP-UX Release 11i: December 2000
___
___