9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / ungetc.3c
blobf370585da47a14237c94c82a5e15d487db013dbf
1 '\" te
2 .\" Copyright 1989 AT&T  Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH UNGETC 3C "Sep 10, 2003"
7 .SH NAME
8 ungetc \- push byte back into input stream
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <stdio.h>
14 \fBint\fR \fBungetc\fR(\fBint\fR \fIc\fR, \fBFILE *\fR\fIstream\fR);
15 .fi
17 .SH DESCRIPTION
18 .sp
19 .LP
20 The \fBungetc()\fR function pushes the byte specified by \fIc\fR (converted to
21 an \fBunsigned char\fR) back onto the input stream pointed to by \fIstream\fR.
22 The pushed-back bytes will be returned by subsequent reads on that stream in
23 the reverse order of their pushing. A successful intervening call (with the
24 stream pointed to by \fIstream\fR) to a file-positioning function (
25 \fBfseek\fR(3C), \fBfsetpos\fR(3C) or \fBrewind\fR(3C)) discards any
26 pushed-back bytes for the stream. The external storage corresponding to the
27 stream is unchanged.
28 .sp
29 .LP
30 Four bytes of push-back are guaranteed.  If \fBungetc()\fR is called too many
31 times on the same stream without an intervening read or file-positioning
32 operation on that stream, the operation may fail.
33 .sp
34 .LP
35 If the value of \fIc\fR equals that of the macro \fBEOF\fR, the operation fails
36 and the input stream is unchanged.
37 .sp
38 .LP
39 A successful call to \fBungetc()\fR clears the end-of-file indicator for the
40 stream. The value of the file-position indicator for the stream after reading
41 or discarding all pushed-back bytes will be the same as it was before the bytes
42 were pushed back. The file-position indicator is decremented by each successful
43 call to \fBungetc()\fR; if its value was 0 before a call, its value is
44 indeterminate after the call.
45 .SH RETURN VALUES
46 .sp
47 .LP
48 Upon successful completion, \fBungetc()\fR returns the byte pushed back after
49 conversion.  Otherwise it returns \fBEOF.\fR
50 .SH ERRORS
51 .sp
52 .LP
53 No errors are defined.
54 .SH ATTRIBUTES
55 .sp
56 .LP
57 See \fBattributes\fR(5) for descriptions of the following attributes:
58 .sp
60 .sp
61 .TS
62 box;
63 c | c
64 l | l .
65 ATTRIBUTE TYPE  ATTRIBUTE VALUE
67 Interface Stability     Standard
69 MT-Level        MT-Safe
70 .TE
72 .SH SEE ALSO
73 .sp
74 .LP
75 \fBread\fR(2), \fBIntro\fR(3), \fB__fsetlocking\fR(3C), \fBfseek\fR(3C),
76 \fBfsetpos\fR(3C), \fBgetc\fR(3C), \fBsetbuf\fR(3C), \fBstdio\fR(3C),
77 \fBattributes\fR(5), \fBstandards\fR(5)