xref: /dflybsd-src/lib/libc/stdio/fgetwln.3 (revision 62f0872080cf6dbb5111fe3e9937501fd8e28c9c)
1*62f08720SJoerg Sonnenberger.\"	$NetBSD: fgetwln.3,v 1.1 2005/05/14 23:51:02 christos Exp $
2*62f08720SJoerg Sonnenberger.\"	$DragonFly: src/lib/libc/stdio/fgetwln.3,v 1.1 2005/07/25 00:37:41 joerg Exp $
3*62f08720SJoerg Sonnenberger.\" Copyright (c) 1990, 1991, 1993
4*62f08720SJoerg Sonnenberger.\"	The Regents of the University of California.  All rights reserved.
5*62f08720SJoerg Sonnenberger.\"
6*62f08720SJoerg Sonnenberger.\" Redistribution and use in source and binary forms, with or without
7*62f08720SJoerg Sonnenberger.\" modification, are permitted provided that the following conditions
8*62f08720SJoerg Sonnenberger.\" are met:
9*62f08720SJoerg Sonnenberger.\" 1. Redistributions of source code must retain the above copyright
10*62f08720SJoerg Sonnenberger.\"    notice, this list of conditions and the following disclaimer.
11*62f08720SJoerg Sonnenberger.\" 2. Redistributions in binary form must reproduce the above copyright
12*62f08720SJoerg Sonnenberger.\"    notice, this list of conditions and the following disclaimer in the
13*62f08720SJoerg Sonnenberger.\"    documentation and/or other materials provided with the distribution.
14*62f08720SJoerg Sonnenberger.\" 3. All advertising materials mentioning features or use of this software
15*62f08720SJoerg Sonnenberger.\"    must display the following acknowledgement:
16*62f08720SJoerg Sonnenberger.\"	This product includes software developed by the University of
17*62f08720SJoerg Sonnenberger.\"	California, Berkeley and its contributors.
18*62f08720SJoerg Sonnenberger.\" 4. Neither the name of the University nor the names of its contributors
19*62f08720SJoerg Sonnenberger.\"    may be used to endorse or promote products derived from this software
20*62f08720SJoerg Sonnenberger.\"    without specific prior written permission.
21*62f08720SJoerg Sonnenberger.\"
22*62f08720SJoerg Sonnenberger.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*62f08720SJoerg Sonnenberger.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*62f08720SJoerg Sonnenberger.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*62f08720SJoerg Sonnenberger.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*62f08720SJoerg Sonnenberger.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*62f08720SJoerg Sonnenberger.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*62f08720SJoerg Sonnenberger.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*62f08720SJoerg Sonnenberger.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*62f08720SJoerg Sonnenberger.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*62f08720SJoerg Sonnenberger.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*62f08720SJoerg Sonnenberger.\" SUCH DAMAGE.
33*62f08720SJoerg Sonnenberger.\"
34*62f08720SJoerg Sonnenberger.\"     @(#)fgetln.3	8.3 (Berkeley) 4/19/94
35*62f08720SJoerg Sonnenberger.\" $FreeBSD: src/lib/libc/stdio/fgetwln.3,v 1.1 2004/07/16 06:06:09 tjr Exp $
36*62f08720SJoerg Sonnenberger.\"
37*62f08720SJoerg Sonnenberger.Dd July 16, 2004
38*62f08720SJoerg Sonnenberger.Dt FGETWLN 3
39*62f08720SJoerg Sonnenberger.Os
40*62f08720SJoerg Sonnenberger.Sh NAME
41*62f08720SJoerg Sonnenberger.Nm fgetwln
42*62f08720SJoerg Sonnenberger.Nd get a line of wide characters from a stream
43*62f08720SJoerg Sonnenberger.Sh LIBRARY
44*62f08720SJoerg Sonnenberger.Lb libc
45*62f08720SJoerg Sonnenberger.Sh SYNOPSIS
46*62f08720SJoerg Sonnenberger.In stdio.h
47*62f08720SJoerg Sonnenberger.In wchar.h
48*62f08720SJoerg Sonnenberger.Ft wchar_t *
49*62f08720SJoerg Sonnenberger.Fn fgetwln "FILE * restrict stream" "size_t * restrict len"
50*62f08720SJoerg Sonnenberger.Sh DESCRIPTION
51*62f08720SJoerg SonnenbergerThe
52*62f08720SJoerg Sonnenberger.Fn fgetwln
53*62f08720SJoerg Sonnenbergerfunction
54*62f08720SJoerg Sonnenbergerreturns a pointer to the next line from the stream referenced by
55*62f08720SJoerg Sonnenberger.Fa stream .
56*62f08720SJoerg SonnenbergerThis line is
57*62f08720SJoerg Sonnenberger.Em not
58*62f08720SJoerg Sonnenbergera standard wide character string as it does not end with a terminating
59*62f08720SJoerg Sonnenbergernull wide character.
60*62f08720SJoerg SonnenbergerThe length of the line, including the final newline,
61*62f08720SJoerg Sonnenbergeris stored in the memory location to which
62*62f08720SJoerg Sonnenberger.Fa len
63*62f08720SJoerg Sonnenbergerpoints.
64*62f08720SJoerg Sonnenberger(Note, however, that if the line is the last
65*62f08720SJoerg Sonnenbergerin a file that does not end in a newline,
66*62f08720SJoerg Sonnenbergerthe returned text will not contain a newline.)
67*62f08720SJoerg Sonnenberger.Sh RETURN VALUES
68*62f08720SJoerg SonnenbergerUpon successful completion a pointer is returned;
69*62f08720SJoerg Sonnenbergerthis pointer becomes invalid after the next
70*62f08720SJoerg Sonnenberger.Tn I/O
71*62f08720SJoerg Sonnenbergeroperation on
72*62f08720SJoerg Sonnenberger.Fa stream
73*62f08720SJoerg Sonnenberger(whether successful or not)
74*62f08720SJoerg Sonnenbergeror as soon as the stream is closed.
75*62f08720SJoerg SonnenbergerOtherwise,
76*62f08720SJoerg Sonnenberger.Dv NULL
77*62f08720SJoerg Sonnenbergeris returned.
78*62f08720SJoerg SonnenbergerThe
79*62f08720SJoerg Sonnenberger.Fn fgetwln
80*62f08720SJoerg Sonnenbergerfunction
81*62f08720SJoerg Sonnenbergerdoes not distinguish between end-of-file and error; the routines
82*62f08720SJoerg Sonnenberger.Xr feof 3
83*62f08720SJoerg Sonnenbergerand
84*62f08720SJoerg Sonnenberger.Xr ferror 3
85*62f08720SJoerg Sonnenbergermust be used
86*62f08720SJoerg Sonnenbergerto determine which occurred.
87*62f08720SJoerg SonnenbergerIf an error occurs, the global variable
88*62f08720SJoerg Sonnenberger.Va errno
89*62f08720SJoerg Sonnenbergeris set to indicate the error.
90*62f08720SJoerg SonnenbergerThe end-of-file condition is remembered, even on a terminal, and all
91*62f08720SJoerg Sonnenbergersubsequent attempts to read will return
92*62f08720SJoerg Sonnenberger.Dv NULL
93*62f08720SJoerg Sonnenbergeruntil the condition is
94*62f08720SJoerg Sonnenbergercleared with
95*62f08720SJoerg Sonnenberger.Xr clearerr 3 .
96*62f08720SJoerg Sonnenberger.Pp
97*62f08720SJoerg SonnenbergerThe text to which the returned pointer points may be modified,
98*62f08720SJoerg Sonnenbergerprovided that no changes are made beyond the returned size.
99*62f08720SJoerg SonnenbergerThese changes are lost as soon as the pointer becomes invalid.
100*62f08720SJoerg Sonnenberger.Sh ERRORS
101*62f08720SJoerg Sonnenberger.Bl -tag -width Er
102*62f08720SJoerg Sonnenberger.It Bq Er EBADF
103*62f08720SJoerg SonnenbergerThe argument
104*62f08720SJoerg Sonnenberger.Fa stream
105*62f08720SJoerg Sonnenbergeris not a stream open for reading.
106*62f08720SJoerg Sonnenberger.El
107*62f08720SJoerg Sonnenberger.Pp
108*62f08720SJoerg SonnenbergerThe
109*62f08720SJoerg Sonnenberger.Fn fgetwln
110*62f08720SJoerg Sonnenbergerfunction
111*62f08720SJoerg Sonnenbergermay also fail and set
112*62f08720SJoerg Sonnenberger.Va errno
113*62f08720SJoerg Sonnenbergerfor any of the errors specified for the routines
114*62f08720SJoerg Sonnenberger.Xr mbrtowc 3 ,
115*62f08720SJoerg Sonnenberger.Xr realloc 3 ,
116*62f08720SJoerg Sonnenbergeror
117*62f08720SJoerg Sonnenberger.Xr read 2 .
118*62f08720SJoerg Sonnenberger.Sh SEE ALSO
119*62f08720SJoerg Sonnenberger.Xr ferror 3 ,
120*62f08720SJoerg Sonnenberger.Xr fgetln 3 ,
121*62f08720SJoerg Sonnenberger.Xr fgetws 3 ,
122*62f08720SJoerg Sonnenberger.Xr fopen 3
123