162f08720SJoerg Sonnenberger.\" Copyright (c) 1990, 1991, 1993 262f08720SJoerg Sonnenberger.\" The Regents of the University of California. All rights reserved. 362f08720SJoerg Sonnenberger.\" 462f08720SJoerg Sonnenberger.\" Redistribution and use in source and binary forms, with or without 562f08720SJoerg Sonnenberger.\" modification, are permitted provided that the following conditions 662f08720SJoerg Sonnenberger.\" are met: 762f08720SJoerg Sonnenberger.\" 1. Redistributions of source code must retain the above copyright 862f08720SJoerg Sonnenberger.\" notice, this list of conditions and the following disclaimer. 962f08720SJoerg Sonnenberger.\" 2. Redistributions in binary form must reproduce the above copyright 1062f08720SJoerg Sonnenberger.\" notice, this list of conditions and the following disclaimer in the 1162f08720SJoerg Sonnenberger.\" documentation and/or other materials provided with the distribution. 12dc71b7abSJustin C. Sherrill.\" 3. Neither the name of the University nor the names of its contributors 1362f08720SJoerg Sonnenberger.\" may be used to endorse or promote products derived from this software 1462f08720SJoerg Sonnenberger.\" without specific prior written permission. 1562f08720SJoerg Sonnenberger.\" 1662f08720SJoerg Sonnenberger.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1762f08720SJoerg Sonnenberger.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1862f08720SJoerg Sonnenberger.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1962f08720SJoerg Sonnenberger.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2062f08720SJoerg Sonnenberger.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2162f08720SJoerg Sonnenberger.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2262f08720SJoerg Sonnenberger.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2362f08720SJoerg Sonnenberger.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2462f08720SJoerg Sonnenberger.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2562f08720SJoerg Sonnenberger.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2662f08720SJoerg Sonnenberger.\" SUCH DAMAGE. 2762f08720SJoerg Sonnenberger.\" 2862f08720SJoerg Sonnenberger.\" @(#)fgetln.3 8.3 (Berkeley) 4/19/94 29*0d5acd74SJohn Marino.\" $FreeBSD: head/lib/libc/stdio/fgetwln.3 165903 2007-01-09 00:28:16Z imp $ 3062f08720SJoerg Sonnenberger.\" 3162f08720SJoerg Sonnenberger.Dd July 16, 2004 3262f08720SJoerg Sonnenberger.Dt FGETWLN 3 3362f08720SJoerg Sonnenberger.Os 3462f08720SJoerg Sonnenberger.Sh NAME 3562f08720SJoerg Sonnenberger.Nm fgetwln 3662f08720SJoerg Sonnenberger.Nd get a line of wide characters from a stream 3762f08720SJoerg Sonnenberger.Sh LIBRARY 3862f08720SJoerg Sonnenberger.Lb libc 3962f08720SJoerg Sonnenberger.Sh SYNOPSIS 4062f08720SJoerg Sonnenberger.In stdio.h 4162f08720SJoerg Sonnenberger.In wchar.h 4262f08720SJoerg Sonnenberger.Ft wchar_t * 4362f08720SJoerg Sonnenberger.Fn fgetwln "FILE * restrict stream" "size_t * restrict len" 4462f08720SJoerg Sonnenberger.Sh DESCRIPTION 4562f08720SJoerg SonnenbergerThe 4662f08720SJoerg Sonnenberger.Fn fgetwln 4762f08720SJoerg Sonnenbergerfunction 4862f08720SJoerg Sonnenbergerreturns a pointer to the next line from the stream referenced by 4962f08720SJoerg Sonnenberger.Fa stream . 5062f08720SJoerg SonnenbergerThis line is 5162f08720SJoerg Sonnenberger.Em not 5262f08720SJoerg Sonnenbergera standard wide character string as it does not end with a terminating 5362f08720SJoerg Sonnenbergernull wide character. 5462f08720SJoerg SonnenbergerThe length of the line, including the final newline, 5562f08720SJoerg Sonnenbergeris stored in the memory location to which 5662f08720SJoerg Sonnenberger.Fa len 5762f08720SJoerg Sonnenbergerpoints. 5862f08720SJoerg Sonnenberger(Note, however, that if the line is the last 5962f08720SJoerg Sonnenbergerin a file that does not end in a newline, 6062f08720SJoerg Sonnenbergerthe returned text will not contain a newline.) 6162f08720SJoerg Sonnenberger.Sh RETURN VALUES 6262f08720SJoerg SonnenbergerUpon successful completion a pointer is returned; 6362f08720SJoerg Sonnenbergerthis pointer becomes invalid after the next 6462f08720SJoerg Sonnenberger.Tn I/O 6562f08720SJoerg Sonnenbergeroperation on 6662f08720SJoerg Sonnenberger.Fa stream 6762f08720SJoerg Sonnenberger(whether successful or not) 6862f08720SJoerg Sonnenbergeror as soon as the stream is closed. 6962f08720SJoerg SonnenbergerOtherwise, 7062f08720SJoerg Sonnenberger.Dv NULL 7162f08720SJoerg Sonnenbergeris returned. 7262f08720SJoerg SonnenbergerThe 7362f08720SJoerg Sonnenberger.Fn fgetwln 7462f08720SJoerg Sonnenbergerfunction 7562f08720SJoerg Sonnenbergerdoes not distinguish between end-of-file and error; the routines 7662f08720SJoerg Sonnenberger.Xr feof 3 7762f08720SJoerg Sonnenbergerand 7862f08720SJoerg Sonnenberger.Xr ferror 3 7962f08720SJoerg Sonnenbergermust be used 8062f08720SJoerg Sonnenbergerto determine which occurred. 8162f08720SJoerg SonnenbergerIf an error occurs, the global variable 8262f08720SJoerg Sonnenberger.Va errno 8362f08720SJoerg Sonnenbergeris set to indicate the error. 8462f08720SJoerg SonnenbergerThe end-of-file condition is remembered, even on a terminal, and all 8562f08720SJoerg Sonnenbergersubsequent attempts to read will return 8662f08720SJoerg Sonnenberger.Dv NULL 8762f08720SJoerg Sonnenbergeruntil the condition is 8862f08720SJoerg Sonnenbergercleared with 8962f08720SJoerg Sonnenberger.Xr clearerr 3 . 9062f08720SJoerg Sonnenberger.Pp 9162f08720SJoerg SonnenbergerThe text to which the returned pointer points may be modified, 9262f08720SJoerg Sonnenbergerprovided that no changes are made beyond the returned size. 9362f08720SJoerg SonnenbergerThese changes are lost as soon as the pointer becomes invalid. 9462f08720SJoerg Sonnenberger.Sh ERRORS 9562f08720SJoerg Sonnenberger.Bl -tag -width Er 9662f08720SJoerg Sonnenberger.It Bq Er EBADF 9762f08720SJoerg SonnenbergerThe argument 9862f08720SJoerg Sonnenberger.Fa stream 9962f08720SJoerg Sonnenbergeris not a stream open for reading. 10062f08720SJoerg Sonnenberger.El 10162f08720SJoerg Sonnenberger.Pp 10262f08720SJoerg SonnenbergerThe 10362f08720SJoerg Sonnenberger.Fn fgetwln 10462f08720SJoerg Sonnenbergerfunction 10562f08720SJoerg Sonnenbergermay also fail and set 10662f08720SJoerg Sonnenberger.Va errno 10762f08720SJoerg Sonnenbergerfor any of the errors specified for the routines 10862f08720SJoerg Sonnenberger.Xr mbrtowc 3 , 10962f08720SJoerg Sonnenberger.Xr realloc 3 , 11062f08720SJoerg Sonnenbergeror 11162f08720SJoerg Sonnenberger.Xr read 2 . 11262f08720SJoerg Sonnenberger.Sh SEE ALSO 11362f08720SJoerg Sonnenberger.Xr ferror 3 , 11462f08720SJoerg Sonnenberger.Xr fgetln 3 , 11562f08720SJoerg Sonnenberger.Xr fgetws 3 , 11662f08720SJoerg Sonnenberger.Xr fopen 3 117