1.\" $OpenBSD: fgetwln.3,v 1.2 2015/01/13 14:02:30 schwarze Exp $ 2.\" 3.\" Copyright (c) 1990, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.Dd $Mdocdate: January 13 2015 $ 31.Dt FGETWLN 3 32.Os 33.Sh NAME 34.Nm fgetwln 35.Nd get a line of wide characters from a stream 36.Sh SYNOPSIS 37.In stdio.h 38.In wchar.h 39.Ft wchar_t * 40.Fn fgetwln "FILE * restrict stream" "size_t * restrict len" 41.Sh DESCRIPTION 42The 43.Fn fgetwln 44function returns a pointer to the next line from the stream referenced by 45.Fa stream . 46This line is 47.Em not 48a standard wide-character string as it does not end with a terminating 49null wide character. 50The length of the line, including the final newline, 51is stored in the memory location to which 52.Fa len 53points and is guaranteed to be greater than 0 upon successful completion. 54(Note, however, that if the last line in the stream does not end in a newline, 55the returned text will not contain a newline.) 56.Sh RETURN VALUES 57Upon successful completion a pointer is returned; 58this pointer becomes invalid after the next I/O operation on 59.Fa stream 60(whether successful or not) 61or as soon as the stream is closed. 62Otherwise, 63.Dv NULL 64is returned. 65.Pp 66The 67.Fn fgetwln 68function does not distinguish between end-of-file and error; the routines 69.Xr feof 3 70and 71.Xr ferror 3 72must be used 73to determine which occurred. 74If an error occurs, the global variable 75.Va errno 76is set to indicate the error. 77The end-of-file condition is remembered, even on a terminal, and all 78subsequent attempts to read will return 79.Dv NULL 80until the condition is 81cleared with 82.Xr clearerr 3 . 83.Pp 84The text to which the returned pointer points may be modified, 85provided that no changes are made beyond the returned size. 86These changes are lost as soon as the pointer becomes invalid. 87.Sh ERRORS 88.Bl -tag -width [EBADF] 89.It Bq Er EBADF 90The argument 91.Fa stream 92is not a stream open for reading. 93.El 94.Pp 95The 96.Fn fgetwln 97function may also fail and set 98.Va errno 99for any of the errors specified for the routines 100.Xr malloc 3 , 101.Xr mbrtowc 3 , 102.Xr read 2 , 103.Xr stat 2 , 104or 105.Xr realloc 3 . 106.Sh SEE ALSO 107.Xr ferror 3 , 108.Xr fgetln 3 , 109.Xr fgetws 3 , 110.Xr fopen 3 111.Sh HISTORY 112The 113.Fn fgetwln 114function first appeared in 115.Ox 5.7 . 116