ungetwc(3I)
NAME
ungetwc − push a Process Code character back into input stream
SYNOPSIS
cc [ flag ... ] file ... −lw [ library ... ]
#include <stdio.h>
#include <widec.h>
int ungetwc(int c, FILE ∗stream);
MT-LEVEL
MT-Safe
DESCRIPTION
ungetwc() pushes back the Process Code character c onto an input stream. That character will be returned by the next getwc() call on that stream. ungetwc() returns c, and leaves the file stream unchanged.
One character of pushback is guaranteed provided something has been read from the stream and the stream is actually buffered. In the case that stream is stdin, one character may be pushed back onto the buffer without a previous read statement.
If c equals EOF, ungetwc() does nothing to the buffer and returns EOF.
An fseek(3S) erases all memory of pushed back characters.
RETURN VALUES
ungetwc() returns EOF if it can’t push a character back.
SEE ALSO
fseek(3S), getwc(3I), setbuf(3S), ungetc(3S)
SunOS 5.2 — Last change: 22 Jan 1993