fgetws(3) — Subroutines
NAME
fgetws − Get a string from a stream
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <wchar.h>
wchar_t ∗fgetws(
wchar_t ∗string,
int number,
FILE ∗stream);
PARAMETERS
stringPoints to a string to receive characters.
streamPoints to the FILE structure of an open file.
numberSpecifies an upper bound on the number of characters to read.
DESCRIPTION
The fgetws() function reads characters from the stream, converts them into the corresponding wide character codes, and stores them in the wchar_t array pointed to by the string parameter. It reads until number-1 characters have been read, it has read and stored in the buffer the ’\n’ newline character, or it has encountered the end of file condition. It appends a null wide character code to string.
This function parallels the fgets() function.
RETURN VALUES
If the end of the file is encountered and no characters were read, no characters are transferred to the string parameter and a null pointer is returned. If a read error occurs or the function cannot convert the character to a wide character code, a NULL pointer is returned. Otherwise, string is returned.
ERRORS
If any of the following conditions occur, the fgetws() function fails and sets errno to the corresponding value.
[EILSEQ]The data obtained from stdin or the stream did not contain valid characters in the current locale.
RELATED INFORMATION
Functions: clearerr(3), feof(3), ferror(3), fileno(3), fopen(3), fputws(3), fread(3), getc(3), gets(3), getwc(3), mbtowc(3), puts(3), scanf(3).