9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / fgetwc.3c
bloba33fce04e261f8fabe78c0a62656ff592ae1e650
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Portions Copyright (c) 1996, Sun Microsystems, Inc.  All Rights Reserved.
44 .\" Copyright (c) 2003, X/Open Company Limited.  All Rights Reserved.
45 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
46 .\"
47 .TH FGETWC 3C "Jun 24, 2014"
48 .SH NAME
49 fgetwc, fgetwc_l \- get a wide-character code from a stream
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <stdio.h>
54 #include <wchar.h>
56 \fBwint_t\fR \fBfgetwc\fR(\fBFILE *\fR\fIstream\fR);
57 .fi
58 .LP
59 .nf
60 #include <stdio.h>
61 #include <wchar.h>
62 #include <xlocale.h>
64 \fBwint_t\fR \fBfgetwc_l\fR(\fBFILE *\fR\fIstream\fR, \fBlocale_t\fR, \fIloc\fR);
65 .fi
67 .SH DESCRIPTION
68 .sp
69 .LP
70 The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions obtain the next
71 character (if present) from the input stream pointed to by \fIstream\fR,
72 convert that to the corresponding wide-character code and advance the
73 associated file position indicator for the stream (if defined).
74 Whereas \fBfgetwc()\fR uses the current locale, \fBfgetwc_l()\fR uses the
75 locale specified by \fIloc\fR.
76 .LP
77 If an error occurs, the resulting value of the file position indicator for the
78 stream is indeterminate.
79 .LP
80 The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions may mark the \fBst_atime\fR
81 field of the file
82 associated with \fIstream\fR for update. The \fBst_atime\fR field will be
83 marked for update by the first successful execution of \fBfgetwc()\fR,
84 \fBfgetc\fR(3C), \fBfgets\fR(3C), \fBfgetws\fR(3C), \fBfread\fR(3C),
85 \fBfscanf\fR(3C), \fBgetc\fR(3C), \fBgetchar\fR(3C), \fBgets\fR(3C), or
86 \fBscanf\fR(3C) using \fIstream\fR that returns data not supplied by a prior
87 call to \fBungetc\fR(3C) or \fBungetwc\fR(3C).
88 .SH RETURN VALUES
89 .LP
90 Upon successful completion both functions return the
91 wide-character code of the character read from the input stream pointed to by
92 \fIstream\fR converted to a type \fBwint_t\fR.
93 .LP
94 For standard-conforming (see \fBstandards\fR(5)) applications, if the
95 end-of-file indicator for the stream is set, \fBfgetwc()\fR and
96 \fBfgetwc_l()\fR return \fBWEOF\fR whether or not the stream is at
97 end-of-file.
98 .LP
99 If a read error occurs, the error indicator for the stream is set,
100 \fBfgetwc()\fR and \fBfgetwc_l()\fR returns \fBWEOF\fR and sets
101 \fBerrno\fR to indicate the error.
103 If an encoding error occurs, the error indicator for the stream is set,
104 \fBfgetwc()\fR and \fBfgetwc_l()\fR return \fBWEOF\fR, and \fBerrno\fR is
105 set to indicate the error.
106 .SH ERRORS
108 The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions will fail if data needs to be
109 read and:
111 .B EAGAIN
112 The \fBO_NONBLOCK\fR flag is set for the file descriptor underlying
113 \fIstream\fR and the process would be delayed in the \fBfgetwc()\fR or
114 \fBfgetwc_l()\fR operation.
116 .B EBADF
117 The file descriptor underlying \fIstream\fR is not a valid file descriptor open
118 for reading.
120 .B EINTR
121 The read operation was terminated due to the receipt of a signal, and no data
122 was transferred.
124 .B EIO
125 A physical I/O error has occurred, or the process is in a background process
126 group attempting to read from its controlling terminal and either the process
127 is ignoring or blocking the \fBSIGTTIN\fR signal or the process group is
128 orphaned.
130 .B EOVERFLOW
131 The file is a regular file and an attempt was made to read at or beyond the
132 offset maximum associated with the corresponding  \fIstream\fR.
134 The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions may fail if:
136 .B ENOMEM
137 Insufficient memory is available.
139 .B ENXIO
140 A request was made of a non-existent device, or the request was outside the
141 capabilities of the device.
143 .B EILSEQ
144 The data obtained from the input stream does not form a valid character.
145 .SH USAGE
148 The \fBferror\fR(3C) or \fBfeof\fR(3C) functions must be used to distinguish
149 between an error condition and an end-of-file condition.
150 .SH ATTRIBUTES
153 See \fBattributes\fR(5) for descriptions of the following attributes:
155 box;
156 c | c
157 l | l .
158 ATTRIBUTE TYPE  ATTRIBUTE VALUE
160 CSI     Enabled
162 Interface Stability     See below.
164 MT-Level        MT-Safe
169 .B fgetwc()
170 function is Standard.  The
171 .B fgetwc_l()
172 function is Uncommitted.
173 .SH SEE ALSO
175 \fBfeof\fR(3C), \fBferror\fR(3C), \fBfgetc\fR(3C), \fBfgets\fR(3C),
176 \fBfgetws\fR(3C), \fBfopen\fR(3C), \fBfread\fR(3C), \fBfscanf\fR(3C),
177 \fBgetc\fR(3C), \fBgetchar\fR(3C), \fBgets\fR(3C), \fBscanf\fR(3C),
178 \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBungetc\fR(3C), \fBungetwc\fR(3C),
179 \fBuselocale\fR(3C), \fBattributes\fR(5),
180 \fBstandards\fR(5)