xref: /freebsd/lib/libc/stdio/fgetws.3 (revision e74101e4eff767325553039def89de70b70f36d3)
1e74101e4STim J. Robbins.\" Copyright (c) 1990, 1991, 1993
2e74101e4STim J. Robbins.\"	The Regents of the University of California.  All rights reserved.
3e74101e4STim J. Robbins.\"
4e74101e4STim J. Robbins.\" This code is derived from software contributed to Berkeley by
5e74101e4STim J. Robbins.\" Chris Torek and the American National Standards Committee X3,
6e74101e4STim J. Robbins.\" on Information Processing Systems.
7e74101e4STim J. Robbins.\"
8e74101e4STim J. Robbins.\" Redistribution and use in source and binary forms, with or without
9e74101e4STim J. Robbins.\" modification, are permitted provided that the following conditions
10e74101e4STim J. Robbins.\" are met:
11e74101e4STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright
12e74101e4STim J. Robbins.\"    notice, this list of conditions and the following disclaimer.
13e74101e4STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright
14e74101e4STim J. Robbins.\"    notice, this list of conditions and the following disclaimer in the
15e74101e4STim J. Robbins.\"    documentation and/or other materials provided with the distribution.
16e74101e4STim J. Robbins.\" 3. All advertising materials mentioning features or use of this software
17e74101e4STim J. Robbins.\"    must display the following acknowledgement:
18e74101e4STim J. Robbins.\"	This product includes software developed by the University of
19e74101e4STim J. Robbins.\"	California, Berkeley and its contributors.
20e74101e4STim J. Robbins.\" 4. Neither the name of the University nor the names of its contributors
21e74101e4STim J. Robbins.\"    may be used to endorse or promote products derived from this software
22e74101e4STim J. Robbins.\"    without specific prior written permission.
23e74101e4STim J. Robbins.\"
24e74101e4STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25e74101e4STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26e74101e4STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27e74101e4STim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28e74101e4STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29e74101e4STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30e74101e4STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31e74101e4STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32e74101e4STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33e74101e4STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34e74101e4STim J. Robbins.\" SUCH DAMAGE.
35e74101e4STim J. Robbins.\"
36e74101e4STim J. Robbins.\"     @(#)fgets.3	8.1 (Berkeley) 6/4/93
37e74101e4STim J. Robbins.\" FreeBSD: src/lib/libc/stdio/fgets.3,v 1.16 2002/05/31 05:01:17 archie Exp
38e74101e4STim J. Robbins.\" $FreeBSD$
39e74101e4STim J. Robbins.\"
40e74101e4STim J. Robbins.Dd August 6, 2002
41e74101e4STim J. Robbins.Dt FGETWS 3
42e74101e4STim J. Robbins.Os
43e74101e4STim J. Robbins.Sh NAME
44e74101e4STim J. Robbins.Nm fgetws
45e74101e4STim J. Robbins.Nd get a line of wide characters from a stream
46e74101e4STim J. Robbins.Sh LIBRARY
47e74101e4STim J. Robbins.Lb libc
48e74101e4STim J. Robbins.Sh SYNOPSIS
49e74101e4STim J. Robbins.In stdio.h
50e74101e4STim J. Robbins.In wchar.h
51e74101e4STim J. Robbins.Ft "wchar_t *"
52e74101e4STim J. Robbins.Fn fgetws "wchar_t *restrict ws" "int n" "FILE *restrict fp"
53e74101e4STim J. Robbins.Sh DESCRIPTION
54e74101e4STim J. RobbinsThe
55e74101e4STim J. Robbins.Fn fgetws
56e74101e4STim J. Robbinsfunction
57e74101e4STim J. Robbinsreads at most one less than the number of characters specified by
58e74101e4STim J. Robbins.Fa n
59e74101e4STim J. Robbinsfrom the given
60e74101e4STim J. Robbins.Fa fp
61e74101e4STim J. Robbinsand stores them in the wide character string
62e74101e4STim J. Robbins.Fa ws .
63e74101e4STim J. RobbinsReading stops when a newline character is found,
64e74101e4STim J. Robbinsat end-of-file or error.
65e74101e4STim J. RobbinsThe newline, if any, is retained.
66e74101e4STim J. RobbinsIf any characters are read and there is no error, a
67e74101e4STim J. Robbins.Ql \e0
68e74101e4STim J. Robbinscharacter is appended to end the string.
69e74101e4STim J. Robbins.Sh RETURN VALUES
70e74101e4STim J. RobbinsUpon successful completion,
71e74101e4STim J. Robbins.Fn fgetws
72e74101e4STim J. Robbinsreturns
73e74101e4STim J. Robbins.Fa ws .
74e74101e4STim J. RobbinsIf end-of-file occurs before any characters are read,
75e74101e4STim J. Robbins.Fn fgetws
76e74101e4STim J. Robbinsreturns
77e74101e4STim J. Robbins.Dv NULL
78e74101e4STim J. Robbinsand the buffer contents remain unchanged.
79e74101e4STim J. RobbinsIf an error occurs,
80e74101e4STim J. Robbins.Fn fgetws
81e74101e4STim J. Robbinsreturns
82e74101e4STim J. Robbins.Dv NULL
83e74101e4STim J. Robbinsand the buffer contents are indeterminate.
84e74101e4STim J. RobbinsThe
85e74101e4STim J. Robbins.Fn fgetws
86e74101e4STim J. Robbinsfunction
87e74101e4STim J. Robbinsdoes not distinguish between end-of-file and error, and callers must use
88e74101e4STim J. Robbins.Xr feof 3
89e74101e4STim J. Robbinsand
90e74101e4STim J. Robbins.Xr ferror 3
91e74101e4STim J. Robbinsto determine which occurred.
92e74101e4STim J. Robbins.Sh ERRORS
93e74101e4STim J. Robbins.Bl -tag -width Er
94e74101e4STim J. Robbins.It Bq Er EBADF
95e74101e4STim J. RobbinsThe given
96e74101e4STim J. Robbins.Fa fp
97e74101e4STim J. Robbinsargument is not a readable stream.
98e74101e4STim J. Robbins.It Bq Er EILSEQ
99e74101e4STim J. RobbinsThe data obtained from the input stream does not form a valid
100e74101e4STim J. Robbinsmultibyte character.
101e74101e4STim J. Robbins.El
102e74101e4STim J. Robbins.Pp
103e74101e4STim J. RobbinsThe function
104e74101e4STim J. Robbins.Fn fgetws
105e74101e4STim J. Robbinsmay also fail and set
106e74101e4STim J. Robbins.Va errno
107e74101e4STim J. Robbinsfor any of the errors specified for the routines
108e74101e4STim J. Robbins.Xr fflush 3 ,
109e74101e4STim J. Robbins.Xr fstat 2 ,
110e74101e4STim J. Robbins.Xr read 2 ,
111e74101e4STim J. Robbinsor
112e74101e4STim J. Robbins.Xr malloc 3 .
113e74101e4STim J. Robbins.Sh SEE ALSO
114e74101e4STim J. Robbins.Xr feof 3 ,
115e74101e4STim J. Robbins.Xr ferror 3 ,
116e74101e4STim J. Robbins.Xr fgets 3
117e74101e4STim J. Robbins.Sh STANDARDS
118e74101e4STim J. RobbinsThe
119e74101e4STim J. Robbins.Fn fgetws
120e74101e4STim J. Robbinsfunction
121e74101e4STim J. Robbinsconforms to
122e74101e4STim J. Robbins.St -p1003.1-2001 .
123