summaryrefslogtreecommitdiffstats
path: root/man3p/ungetc.3p
blob: 82a50f1a1b9c9312de8be9c99f61db805e0461b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "UNGETC" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" ungetc 
.SH NAME
ungetc \- push byte back into input stream
.SH SYNOPSIS
.LP
\fB#include <stdio.h>
.br
.sp
int ungetc(int\fP \fIc\fP\fB, FILE *\fP\fIstream\fP\fB);
.br
\fP
.SH DESCRIPTION
.LP
The \fIungetc\fP() function shall push the byte specified by \fIc\fP
(converted to an \fBunsigned char\fP) back onto the
input stream pointed to by \fIstream\fP. The pushed-back bytes shall
be returned by subsequent reads on that stream in the reverse
order of their pushing. A successful intervening call (with the stream
pointed to by \fIstream\fP) to a file-positioning function
( \fIfseek\fP(), \fIfsetpos\fP(), or \fIrewind\fP()) shall discard
any pushed-back bytes for the stream. The external storage
corresponding to the stream shall be unchanged.
.LP
One byte of push-back shall be provided. If \fIungetc\fP() is called
too many times on the same stream without an intervening
read or file-positioning operation on that stream, the operation may
fail.
.LP
If the value of \fIc\fP equals that of the macro EOF, the operation
shall fail and the input stream shall be left
unchanged.
.LP
A successful call to \fIungetc\fP() shall clear the end-of-file indicator
for the stream. The value of the file-position
indicator for the stream after reading or discarding all pushed-back
bytes shall be the same as it was before the bytes were pushed
back. The file-position indicator is decremented by each successful
call to \fIungetc\fP(); if its value was 0 before a call, its
value is unspecified after the call.
.SH RETURN VALUE
.LP
Upon successful completion, \fIungetc\fP() shall return the byte pushed
back after conversion. Otherwise, it shall return
EOF.
.SH ERRORS
.LP
No errors are defined.
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIfseek\fP() , \fIgetc\fP() , \fIfsetpos\fP() ,
\fIread\fP() , \fIrewind\fP() , \fIsetbuf\fP() , the
Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<stdio.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .