]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fgetwc.3
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man3 / fgetwc.3
CommitLineData
fea681da
MK
1.\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2.\"
e4a74ca8 3.\" SPDX-License-Identifier: GPL-2.0-or-later
fea681da
MK
4.\"
5.\" References consulted:
6.\" GNU glibc-2 source code and manual
7.\" Dinkumware C library reference http://www.dinkumware.com/
008f1ecc 8.\" OpenGroup's Single UNIX specification
fea681da
MK
9.\" http://www.UNIX-systems.org/online.html
10.\" ISO/IEC 9899:1999
11.\"
12.\" Modified Tue Oct 16 23:18:40 BST 2001 by John Levon <moz@compsoc.man.ac.uk>
4c1c5274 13.TH fgetwc 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
14.SH NAME
15fgetwc, getwc \- read a wide character from a FILE stream
afa8db94
AC
16.SH LIBRARY
17Standard C library
18.RI ( libc ", " \-lc )
fea681da
MK
19.SH SYNOPSIS
20.nf
21.B #include <stdio.h>
fea681da 22.B #include <wchar.h>
68e4db0a 23.PP
fea681da
MK
24.BI "wint_t fgetwc(FILE *" stream );
25.BI "wint_t getwc(FILE *" stream );
26.fi
27.SH DESCRIPTION
60a90ecd
MK
28The
29.BR fgetwc ()
30function is the wide-character equivalent
31of the
363a3cc9 32.BR fgetc (3)
60a90ecd 33function.
c13182ef
MK
34It reads a wide character from \fIstream\fP and returns it.
35If the end of stream is reached, or if \fIferror(stream)\fP becomes true,
cab87712
MK
36it returns
37.BR WEOF .
d0f17b57 38If a wide-character conversion error occurs, it sets
cab87712
MK
39\fIerrno\fP to \fBEILSEQ\fP and returns
40.BR WEOF .
fea681da 41.PP
60a90ecd
MK
42The
43.BR getwc ()
44function or macro functions identically to
45.BR fgetwc ().
fea681da 46It may be implemented as a macro, and may evaluate its argument
c13182ef
MK
47more than once.
48There is no reason ever to use it.
fea681da 49.PP
24b74457 50For nonlocking counterparts, see
fea681da 51.BR unlocked_stdio (3).
47297adb 52.SH RETURN VALUE
cb6a894e 53On success,
60a90ecd 54.BR fgetwc ()
cb6a894e
MK
55returns the next wide-character from the stream.
56Otherwise,
57.B WEOF
58is returned, and
dbf51683 59.I errno
cb6a894e 60is set to indicate the error.
fea681da
MK
61.SH ERRORS
62Apart from the usual ones, there is
63.TP
64.B EILSEQ
65The data obtained from the input stream does not
66form a valid character.
b73c480b
MS
67.SH ATTRIBUTES
68For an explanation of the terms used in this section, see
69.BR attributes (7).
c466875e
MK
70.ad l
71.nh
b73c480b
MS
72.TS
73allbox;
c466875e 74lbx lb lb
b73c480b
MS
75l l l.
76Interface Attribute Value
77T{
78.BR fgetwc (),
79.BR getwc ()
80T} Thread safety MT-Safe
81.TE
c466875e
MK
82.hy
83.ad
84.sp 1
3113c7f3 85.SH STANDARDS
29680d10 86POSIX.1-2001, POSIX.1-2008, C99.
fea681da 87.SH NOTES
d9bfdb9c 88The behavior of
60a90ecd 89.BR fgetwc ()
1274071a
MK
90depends on the
91.B LC_CTYPE
92category of the
fea681da
MK
93current locale.
94.PP
c13182ef 95In the absence of additional information passed to the
fb186734 96.BR fopen (3)
1e321034 97call, it is
60a90ecd
MK
98reasonable to expect that
99.BR fgetwc ()
35478399 100will actually read a multibyte sequence
fea681da 101from the stream and then convert it to a wide character.
47297adb 102.SH SEE ALSO
fea681da
MK
103.BR fgetws (3),
104.BR fputwc (3),
105.BR ungetwc (3),
106.BR unlocked_stdio (3)