1FGETWC(3) Linux Programmer's Manual FGETWC(3)
2
3
4
6 fgetwc, getwc - read a wide character from a FILE stream
7
9 #include <stdio.h>
10 #include <wchar.h>
11
12 wint_t fgetwc(FILE *stream);
13 wint_t getwc(FILE *stream);
14
16 The fgetwc() function is the wide-character equivalent of the fgetc(3)
17 function. It reads a wide character from stream and returns it. If
18 the end of stream is reached, or if ferror(stream) becomes true, it re‐
19 turns WEOF. If a wide-character conversion error occurs, it sets errno
20 to EILSEQ and returns WEOF.
21
22 The getwc() function or macro functions identically to fgetwc(). It
23 may be implemented as a macro, and may evaluate its argument more than
24 once. There is no reason ever to use it.
25
26 For nonlocking counterparts, see unlocked_stdio(3).
27
29 On success, fgetwc() returns the next wide-character from the stream.
30 Otherwise, WEOF is returned, and errno is set to indicate the error.
31
33 Apart from the usual ones, there is
34
35 EILSEQ The data obtained from the input stream does not form a valid
36 character.
37
39 For an explanation of the terms used in this section, see at‐
40 tributes(7).
41
42 ┌────────────────────────────────────────────┬───────────────┬─────────┐
43 │Interface │ Attribute │ Value │
44 ├────────────────────────────────────────────┼───────────────┼─────────┤
45 │fgetwc(), getwc() │ Thread safety │ MT-Safe │
46 └────────────────────────────────────────────┴───────────────┴─────────┘
47
49 POSIX.1-2001, POSIX.1-2008, C99.
50
52 The behavior of fgetwc() depends on the LC_CTYPE category of the cur‐
53 rent locale.
54
55 In the absence of additional information passed to the fopen(3) call,
56 it is reasonable to expect that fgetwc() will actually read a multibyte
57 sequence from the stream and then convert it to a wide character.
58
60 fgetws(3), fputwc(3), ungetwc(3), unlocked_stdio(3)
61
63 This page is part of release 5.12 of the Linux man-pages project. A
64 description of the project, information about reporting bugs, and the
65 latest version of this page, can be found at
66 https://www.kernel.org/doc/man-pages/.
67
68
69
70GNU 2021-03-22 FGETWC(3)