1FGETWS(3) Linux Programmer's Manual FGETWS(3)
2
3
4
6 fgetws - read a wide-character string from a FILE stream
7
9 #include <wchar.h>
10
11 wchar_t *fgetws(wchar_t *ws, int n, FILE *stream);
12
14 The fgetws() function is the wide-character equivalent of the fgets(3)
15 function. It reads a string of at most n-1 wide characters into the
16 wide-character array pointed to by ws, and adds a terminating null wide
17 character (L'\0'). It stops reading wide characters after it has
18 encountered and stored a newline wide character. It also stops when
19 end of stream is reached.
20
21 The programmer must ensure that there is room for at least n wide char‐
22 acters at ws.
23
24 For a nonlocking counterpart, see unlocked_stdio(3).
25
27 The fgetws() function, if successful, returns ws. If end of stream was
28 already reached or if an error occurred, it returns NULL.
29
31 For an explanation of the terms used in this section, see
32 attributes(7).
33
34 ┌──────────┬───────────────┬─────────┐
35 │Interface │ Attribute │ Value │
36 ├──────────┼───────────────┼─────────┤
37 │fgetws() │ Thread safety │ MT-Safe │
38 └──────────┴───────────────┴─────────┘
40 POSIX.1-2001, POSIX.1-2008, C99.
41
43 The behavior of fgetws() depends on the LC_CTYPE category of the cur‐
44 rent locale.
45
46 In the absence of additional information passed to the fopen(3) call,
47 it is reasonable to expect that fgetws() will actually read a multibyte
48 string from the stream and then convert it to a wide-character string.
49
50 This function is unreliable, because it does not permit to deal prop‐
51 erly with null wide characters that may be present in the input.
52
54 fgetwc(3), unlocked_stdio(3)
55
57 This page is part of release 5.04 of the Linux man-pages project. A
58 description of the project, information about reporting bugs, and the
59 latest version of this page, can be found at
60 https://www.kernel.org/doc/man-pages/.
61
62
63
64GNU 2019-03-06 FGETWS(3)