]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fgetws.3
ttyslot.3: tfix
[thirdparty/man-pages.git] / man3 / fgetws.3
CommitLineData
fea681da
MK
1.\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2.\"
89e3ffe9 3.\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
fea681da
MK
4.\" This is free documentation; you can redistribute it and/or
5.\" modify it under the terms of the GNU General Public License as
6.\" published by the Free Software Foundation; either version 2 of
7.\" the License, or (at your option) any later version.
fe382ebf 8.\" %%%LICENSE_END
fea681da
MK
9.\"
10.\" References consulted:
11.\" GNU glibc-2 source code and manual
12.\" Dinkumware C library reference http://www.dinkumware.com/
008f1ecc 13.\" OpenGroup's Single UNIX specification
c16f9356 14.\" http://www.UNIX-systems.org/online.html
fea681da
MK
15.\" ISO/IEC 9899:1999
16.\"
17.\" Modified Tue Oct 16 23:18:40 BST 2001 by John Levon <moz@compsoc.man.ac.uk>
460495ca 18.TH FGETWS 3 2015-08-08 "GNU" "Linux Programmer's Manual"
fea681da 19.SH NAME
d0f17b57 20fgetws \- read a wide-character string from a FILE stream
fea681da
MK
21.SH SYNOPSIS
22.nf
23.B #include <wchar.h>
68e4db0a 24.PP
fea681da
MK
25.BI "wchar_t *fgetws(wchar_t *" ws ", int " n ", FILE *" stream );
26.fi
27.SH DESCRIPTION
60a90ecd
MK
28The
29.BR fgetws ()
30function is the wide-character equivalent
31of the
363a3cc9 32.BR fgets (3)
60a90ecd 33function.
c16f9356
MK
34It reads a string of at most \fIn\-1\fP wide characters into the
35wide-character array pointed to by \fIws\fP,
e9c23bc6 36and adds a terminating null wide character (L\(aq\\0\(aq).
c13182ef
MK
37It stops reading wide characters after it has encountered and
38stored a newline wide character.
39It also stops when end of stream is reached.
fea681da
MK
40.PP
41The programmer must ensure that there is room for at least \fIn\fP wide
42characters at \fIws\fP.
43.PP
24b74457 44For a nonlocking counterpart, see
fea681da 45.BR unlocked_stdio (3).
47297adb 46.SH RETURN VALUE
60a90ecd
MK
47The
48.BR fgetws ()
49function, if successful, returns \fIws\fP.
c13182ef 50If end of stream
fea681da 51was already reached or if an error occurred, it returns NULL.
ed8b903b
MS
52.SH ATTRIBUTES
53For an explanation of the terms used in this section, see
54.BR attributes (7).
55.TS
56allbox;
57lb lb lb
58l l l.
59Interface Attribute Value
60T{
61.BR fgetws ()
62T} Thread safety MT-Safe
63.TE
47297adb 64.SH CONFORMING TO
1d47c6ca 65POSIX.1-2001, POSIX.1-2008, C99.
fea681da 66.SH NOTES
d9bfdb9c 67The behavior of
60a90ecd 68.BR fgetws ()
1274071a
MK
69depends on the
70.B LC_CTYPE
71category of the
fea681da
MK
72current locale.
73.PP
c13182ef 74In the absence of additional information passed to the
fb186734 75.BR fopen (3)
1e321034 76call, it is
60a90ecd
MK
77reasonable to expect that
78.BR fgetws ()
fbe183be 79will actually read a multibyte string
d0f17b57 80from the stream and then convert it to a wide-character string.
fea681da 81.PP
fbe183be
MK
82This function is unreliable,
83because it does not permit to deal properly with
fea681da 84null wide characters that may be present in the input.
47297adb 85.SH SEE ALSO
fea681da
MK
86.BR fgetwc (3),
87.BR unlocked_stdio (3)