1fgetws(3)                  Library Functions Manual                  fgetws(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <wchar.h>
13
14       wchar_t *fgetws(wchar_t ws[restrict .n], int n, FILE *restrict stream);
15

DESCRIPTION

17       The  fgetws() function is the wide-character equivalent of the fgets(3)
18       function.  It reads a string of at most n-1 wide  characters  into  the
19       wide-character array pointed to by ws, and adds a terminating null wide
20       character (L'\0').  It stops reading wide characters after it  has  en‐
21       countered  and stored a newline wide character.  It also stops when end
22       of stream is reached.
23
24       The programmer must ensure that there is room for at least n wide char‐
25       acters at ws.
26
27       For a nonlocking counterpart, see unlocked_stdio(3).
28

RETURN VALUE

30       The fgetws() function, if successful, returns ws.  If end of stream was
31       already reached or if an error occurred, it returns NULL.
32

ATTRIBUTES

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

STANDARDS

44       C11, POSIX.1-2008.
45

HISTORY

47       POSIX.1-2001, C99.
48

NOTES

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

SEE ALSO

61       fgetwc(3), unlocked_stdio(3)
62
63
64
65Linux man-pages 6.04              2023-03-30                         fgetws(3)
Impressum