]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fgetws.3
75ed37aa37a64553b147b25b3251a79c9b2e6236
[thirdparty/man-pages.git] / man3 / fgetws.3
1 '\" t
2 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
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 <moz@compsoc.man.ac.uk>
14 .TH fgetws 3 (date) "Linux man-pages (unreleased)"
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 .PP
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]\e0\[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 .PP
41 The programmer must ensure that there is room for at least \fIn\fP wide
42 characters at \fIws\fP.
43 .PP
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 .ad l
56 .nh
57 .TS
58 allbox;
59 lbx lb lb
60 l l l.
61 Interface Attribute Value
62 T{
63 .BR fgetws ()
64 T} Thread safety MT-Safe
65 .TE
66 .hy
67 .ad
68 .sp 1
69 .SH STANDARDS
70 C11, POSIX.1-2008.
71 .SH HISTORY
72 POSIX.1-2001, C99.
73 .SH NOTES
74 The behavior of
75 .BR fgetws ()
76 depends on the
77 .B LC_CTYPE
78 category of the
79 current locale.
80 .PP
81 In the absence of additional information passed to the
82 .BR fopen (3)
83 call, it is
84 reasonable to expect that
85 .BR fgetws ()
86 will actually read a multibyte string
87 from the stream and then convert it to a wide-character string.
88 .PP
89 This function is unreliable,
90 because it does not permit to deal properly with
91 null wide characters that may be present in the input.
92 .SH SEE ALSO
93 .BR fgetwc (3),
94 .BR unlocked_stdio (3)