manual page distributed with 4.1BSD
[unix-history] / usr / src / lib / libc / stdio / ungetc.3
CommitLineData
1f4480e5
KM
1.\" @(#)ungetc.3 4.1 (Berkeley) %G%
2.\"
3.TH UNGETC 3S
4.AT 3
5.SH NAME
6ungetc \- push character back into input stream
7.SH SYNOPSIS
8.B #include <stdio.h>
9.PP
10.B ungetc(c, stream)
11.br
12.SM
13.B FILE
14.B *stream;
15.SH DESCRIPTION
16.I Ungetc
17pushes the character
18.I c
19back on an input stream.
20That character will be returned by the next
21.I getc
22call on that stream.
23.I Ungetc
24returns
25.IR c .
26.PP
27One character of pushback is guaranteed provided
28something has been read from the stream and the stream is
29actually buffered.
30Attempts to push EOF are rejected.
31.PP
32.IR Fseek (3)
33erases all memory of pushed back characters.
34.SH "SEE ALSO"
35getc(3), setbuf(3), fseek(3)
36.SH DIAGNOSTICS
37.I Ungetc
38returns
39.SM
40.B EOF
41if it can't push a character back.