Debian Codegraph @

upstream/debian-trixie/man3/fgetws.3

raw
1 '\" t
2 .\" Copyright (c) Bruno Haible <[email protected]>
3 .\"
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\"
6 .\" References consulted:
7 .\" GNU glibc-2 source code and manual
8 .\" Dinkumware C library reference http://www.dinkumware.com/
9 .\" OpenGroup's Single UNIX specification
10 .\" http://www.UNIX-systems.org/online.html
11 .\" ISO/IEC 9899:1999
12 .\"
13 .\" Modified Tue Oct 16 23:18:40 BST 2001 by John Levon <[email protected]>
14 .TH fgetws 3 2024-06-15 "Linux man-pages 6.9.1"
15 .SH NAME
16 fgetws \- read a wide-character string from a FILE stream
17 .SH LIBRARY
18 Standard C library
19 .RI ( libc ", " \-lc )
20 .SH SYNOPSIS
21 .nf
22 .B #include <wchar.h>
23 .P
24 .BI "wchar_t *fgetws(wchar_t " ws "[restrict ." n "], int " n \
25 ", FILE *restrict " stream );
26 .fi
27 .SH DESCRIPTION
28 The
29 .BR fgetws ()
30 function is the wide-character equivalent
31 of the
32 .BR fgets (3)
33 function.
34 It reads a string of at most \fIn\-1\fP wide characters into the
35 wide-character array pointed to by \fIws\fP,
36 and adds a terminating null wide character (L\[aq]\[rs]0\[aq]).
37 It stops reading wide characters after it has encountered and
38 stored a newline wide character.
39 It also stops when end of stream is reached.
40 .P
41 The programmer must ensure that there is room for at least \fIn\fP wide
42 characters at \fIws\fP.
43 .P
44 For a nonlocking counterpart, see
45 .BR unlocked_stdio (3).
46 .SH RETURN VALUE
47 The
48 .BR fgetws ()
49 function, if successful, returns \fIws\fP.
50 If end of stream
51 was already reached or if an error occurred, it returns NULL.
52 .SH ATTRIBUTES
53 For an explanation of the terms used in this section, see
54 .BR attributes (7).
55 .TS
56 allbox;
57 lbx lb lb
58 l l l.
59 Interface Attribute Value
60 T{
61 .na
62 .nh
63 .BR fgetws ()
64 T} Thread safety MT-Safe
65 .TE
66 .SH STANDARDS
67 C11, POSIX.1-2008.
68 .SH HISTORY
69 POSIX.1-2001, C99.
70 .SH NOTES
71 The behavior of
72 .BR fgetws ()
73 depends on the
74 .B LC_CTYPE
75 category of the
76 current locale.
77 .P
78 In the absence of additional information passed to the
79 .BR fopen (3)
80 call, it is
81 reasonable to expect that
82 .BR fgetws ()
83 will actually read a multibyte string
84 from the stream and then convert it to a wide-character string.
85 .P
86 This function is unreliable,
87 because it does not permit to deal properly with
88 null wide characters that may be present in the input.
89 .SH SEE ALSO
90 .BR fgetwc (3),
91 .BR unlocked_stdio (3)