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