mirror of https://github.com/mkerrisk/man-pages
79 lines
2.7 KiB
Plaintext
79 lines
2.7 KiB
Plaintext
|
.\" 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 .
|