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/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
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.
25 .\" This notice shall appear on any product containing this material.
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.
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.
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]
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>
47 .TH FGETWC 3C "Jun 24, 2014"
49 fgetwc, fgetwc_l \- get a wide-character code from a stream
56 \fBwint_t\fR \fBfgetwc\fR(\fBFILE *\fR\fIstream\fR);
64 \fBwint_t\fR \fBfgetwc_l\fR(\fBFILE *\fR\fIstream\fR, \fBlocale_t\fR, \fIloc\fR);
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.
77 If an error occurs, the resulting value of the file position indicator for the
78 stream is indeterminate.
80 The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions may mark the \fBst_atime\fR
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).
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.
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
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.
108 The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions will fail if data needs to be
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.
117 The file descriptor underlying \fIstream\fR is not a valid file descriptor open
121 The read operation was terminated due to the receipt of a signal, and no data
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
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:
137 Insufficient memory is available.
140 A request was made of a non-existent device, or the request was outside the
141 capabilities of the device.
144 The data obtained from the input stream does not form a valid character.
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.
153 See \fBattributes\fR(5) for descriptions of the following attributes:
158 ATTRIBUTE TYPE ATTRIBUTE VALUE
162 Interface Stability See below.
170 function is Standard. The
172 function is Uncommitted.
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),