xref: /freebsd/lib/libc/stdio/fgetwln.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
19531ef0fSTim J. Robbins.\" Copyright (c) 1990, 1991, 1993
29531ef0fSTim J. Robbins.\"	The Regents of the University of California.  All rights reserved.
39531ef0fSTim J. Robbins.\"
49531ef0fSTim J. Robbins.\" Redistribution and use in source and binary forms, with or without
59531ef0fSTim J. Robbins.\" modification, are permitted provided that the following conditions
69531ef0fSTim J. Robbins.\" are met:
79531ef0fSTim J. Robbins.\" 1. Redistributions of source code must retain the above copyright
89531ef0fSTim J. Robbins.\"    notice, this list of conditions and the following disclaimer.
99531ef0fSTim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright
109531ef0fSTim J. Robbins.\"    notice, this list of conditions and the following disclaimer in the
119531ef0fSTim J. Robbins.\"    documentation and/or other materials provided with the distribution.
12*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
139531ef0fSTim J. Robbins.\"    may be used to endorse or promote products derived from this software
149531ef0fSTim J. Robbins.\"    without specific prior written permission.
159531ef0fSTim J. Robbins.\"
169531ef0fSTim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
179531ef0fSTim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189531ef0fSTim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199531ef0fSTim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
209531ef0fSTim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219531ef0fSTim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229531ef0fSTim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239531ef0fSTim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249531ef0fSTim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259531ef0fSTim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269531ef0fSTim J. Robbins.\" SUCH DAMAGE.
279531ef0fSTim J. Robbins.\"
289531ef0fSTim J. Robbins.Dd July 16, 2004
299531ef0fSTim J. Robbins.Dt FGETWLN 3
309531ef0fSTim J. Robbins.Os
319531ef0fSTim J. Robbins.Sh NAME
329dbf9a4dSChristian Brueffer.Nm fgetwln
339531ef0fSTim J. Robbins.Nd get a line of wide characters from a stream
349531ef0fSTim J. Robbins.Sh LIBRARY
359531ef0fSTim J. Robbins.Lb libc
369531ef0fSTim J. Robbins.Sh SYNOPSIS
379531ef0fSTim J. Robbins.In stdio.h
389531ef0fSTim J. Robbins.In wchar.h
399531ef0fSTim J. Robbins.Ft wchar_t *
409531ef0fSTim J. Robbins.Fn fgetwln "FILE * restrict stream" "size_t * restrict len"
419531ef0fSTim J. Robbins.Sh DESCRIPTION
429531ef0fSTim J. RobbinsThe
439531ef0fSTim J. Robbins.Fn fgetwln
449531ef0fSTim J. Robbinsfunction
459531ef0fSTim J. Robbinsreturns a pointer to the next line from the stream referenced by
469531ef0fSTim J. Robbins.Fa stream .
479531ef0fSTim J. RobbinsThis line is
489531ef0fSTim J. Robbins.Em not
499531ef0fSTim J. Robbinsa standard wide character string as it does not end with a terminating
509531ef0fSTim J. Robbinsnull wide character.
519531ef0fSTim J. RobbinsThe length of the line, including the final newline,
529531ef0fSTim J. Robbinsis stored in the memory location to which
539531ef0fSTim J. Robbins.Fa len
549531ef0fSTim J. Robbinspoints.
559531ef0fSTim J. Robbins(Note, however, that if the line is the last
569531ef0fSTim J. Robbinsin a file that does not end in a newline,
579531ef0fSTim J. Robbinsthe returned text will not contain a newline.)
589531ef0fSTim J. Robbins.Sh RETURN VALUES
599531ef0fSTim J. RobbinsUpon successful completion a pointer is returned;
609531ef0fSTim J. Robbinsthis pointer becomes invalid after the next
619531ef0fSTim J. Robbins.Tn I/O
629531ef0fSTim J. Robbinsoperation on
639531ef0fSTim J. Robbins.Fa stream
649531ef0fSTim J. Robbins(whether successful or not)
659531ef0fSTim J. Robbinsor as soon as the stream is closed.
669531ef0fSTim J. RobbinsOtherwise,
679531ef0fSTim J. Robbins.Dv NULL
689531ef0fSTim J. Robbinsis returned.
699531ef0fSTim J. RobbinsThe
709531ef0fSTim J. Robbins.Fn fgetwln
719531ef0fSTim J. Robbinsfunction
729531ef0fSTim J. Robbinsdoes not distinguish between end-of-file and error; the routines
739531ef0fSTim J. Robbins.Xr feof 3
749531ef0fSTim J. Robbinsand
759531ef0fSTim J. Robbins.Xr ferror 3
769531ef0fSTim J. Robbinsmust be used
779531ef0fSTim J. Robbinsto determine which occurred.
789531ef0fSTim J. RobbinsIf an error occurs, the global variable
799531ef0fSTim J. Robbins.Va errno
809531ef0fSTim J. Robbinsis set to indicate the error.
819531ef0fSTim J. RobbinsThe end-of-file condition is remembered, even on a terminal, and all
829531ef0fSTim J. Robbinssubsequent attempts to read will return
839531ef0fSTim J. Robbins.Dv NULL
849531ef0fSTim J. Robbinsuntil the condition is
859531ef0fSTim J. Robbinscleared with
869531ef0fSTim J. Robbins.Xr clearerr 3 .
879531ef0fSTim J. Robbins.Pp
889531ef0fSTim J. RobbinsThe text to which the returned pointer points may be modified,
899531ef0fSTim J. Robbinsprovided that no changes are made beyond the returned size.
909531ef0fSTim J. RobbinsThese changes are lost as soon as the pointer becomes invalid.
919531ef0fSTim J. Robbins.Sh ERRORS
929531ef0fSTim J. Robbins.Bl -tag -width Er
939531ef0fSTim J. Robbins.It Bq Er EBADF
949531ef0fSTim J. RobbinsThe argument
959531ef0fSTim J. Robbins.Fa stream
969531ef0fSTim J. Robbinsis not a stream open for reading.
979531ef0fSTim J. Robbins.El
989531ef0fSTim J. Robbins.Pp
999531ef0fSTim J. RobbinsThe
1009531ef0fSTim J. Robbins.Fn fgetwln
1019531ef0fSTim J. Robbinsfunction
1029531ef0fSTim J. Robbinsmay also fail and set
1039531ef0fSTim J. Robbins.Va errno
1049531ef0fSTim J. Robbinsfor any of the errors specified for the routines
1059531ef0fSTim J. Robbins.Xr mbrtowc 3 ,
1069531ef0fSTim J. Robbins.Xr realloc 3 ,
1079531ef0fSTim J. Robbinsor
1089531ef0fSTim J. Robbins.Xr read 2 .
1099531ef0fSTim J. Robbins.Sh SEE ALSO
1109531ef0fSTim J. Robbins.Xr ferror 3 ,
1119531ef0fSTim J. Robbins.Xr fgetln 3 ,
1129531ef0fSTim J. Robbins.Xr fgetws 3 ,
1139531ef0fSTim J. Robbins.Xr fopen 3
114