1FGETWS(3)                  Linux Programmer's Manual                 FGETWS(3)
2
3
4

NAME

6       fgetws - read a wide-character string from a FILE stream
7

SYNOPSIS

9       #include <wchar.h>
10
11       wchar_t *fgetws(wchar_t *restrict ws, int n, FILE *restrict stream);
12

DESCRIPTION

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  en‐
18       countered  and stored a newline wide character.  It also stops when end
19       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

RETURN VALUE

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

ATTRIBUTES

31       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
32       tributes(7).
33
34       ┌────────────────────────────────────────────┬───────────────┬─────────┐
35Interface                                   Attribute     Value   
36       ├────────────────────────────────────────────┼───────────────┼─────────┤
37fgetws()                                    │ Thread safety │ MT-Safe │
38       └────────────────────────────────────────────┴───────────────┴─────────┘
39

CONFORMING TO

41       POSIX.1-2001, POSIX.1-2008, C99.
42

NOTES

44       The  behavior  of fgetws() depends on the LC_CTYPE category of the cur‐
45       rent locale.
46
47       In the absence of additional information passed to the  fopen(3)  call,
48       it is reasonable to expect that fgetws() will actually read a multibyte
49       string from the stream and then convert it to a wide-character string.
50
51       This function is unreliable, because it does not permit to deal proper‐
52       ly with null wide characters that may be present in the input.
53

SEE ALSO

55       fgetwc(3), unlocked_stdio(3)
56

COLOPHON

58       This  page  is  part of release 5.13 of the Linux man-pages project.  A
59       description of the project, information about reporting bugs,  and  the
60       latest     version     of     this    page,    can    be    found    at
61       https://www.kernel.org/doc/man-pages/.
62
63
64
65GNU                               2021-03-22                         FGETWS(3)
Impressum