add Berkeley specific copyright notices
[unix-history] / usr / src / lib / libc / stdio / ungetc.3
CommitLineData
e751d114 1.\" @(#)ungetc.3 6.1 (Berkeley) %G%
1f4480e5 2.\"
e751d114 3.TH UNGETC 3S ""
1f4480e5
KM
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
e3cbff53 19back on an input stream. That character will be returned by the next
1f4480e5
KM
20.I getc
21call on that stream.
22.I Ungetc
23returns
24.IR c .
25.PP
26One character of pushback is guaranteed provided
e3cbff53 27something has been read from the stream and the stream is actually buffered.
1f4480e5
KM
28Attempts to push EOF are rejected.
29.PP
e3cbff53 30.IR Fseek (3S)
1f4480e5
KM
31erases all memory of pushed back characters.
32.SH "SEE ALSO"
e3cbff53
KM
33getc(3S),
34setbuf(3S),
35fseek(3S)
1f4480e5
KM
36.SH DIAGNOSTICS
37.I Ungetc
38returns
39.SM
40.B EOF
41if it can't push a character back.