fgetws(3S) fgetws(3S)
NAME
fgetws - get wide character string from a stream
SYNOPSIS
cc [flag ...] file ... -lw [library ...]
#include <stdio.h>
#include <wchar.h>
wchart *fgetws(wchart *ws, int n, FILE *stream);
DESCRIPTION
The fgetws() function reads characters from the stream, converts these
to the corresponding wide-character codes, places them in the wchart
array pointed to by ws, until n-1 characters are read, or a newline
character is read, converted and transferred to ws, or an end-of-file
condition is encountered. The wide-character string, ws, is then ter-
minated with a null wide-character code.
If an error occurs, the resulting value of the file position indicator
for the stream is indeterminate.
The fgetws() function may mark the statime field of the file associ-
ated with stream for update. The statime field will be marked for
update by the first successful execution of fgetc(), fgets(),
fgetwc(), fgetws(), fread(), getc(), getchar(), fgets() or scanf()
using stream that returns data not supplied by a prior call to
ungetc() or ungetwc().
ERRORS
The fgetws() function will fail if data needs to be read and:
EAGAIN The ONONBLOCK flag is set for the file descriptor under-
lying stream and the process would be delayed in the
fgetwc() operation.
EBADF The file-descriptor underlying stream is not a valid file
descriptor open for reading.
EINTR The read operation was terminated due to the receipt of a
signal, and no data was transferred.
EIO The process is in a background process group attempting to
read from the controlling terminal, and either the process
is ignoring or blocking the SIGTTIN signal or the process
group is orphaned. This error may also be generated for
implementation-dependent reasons.
EOVERFLOW The file is a regular file and an attempt was made to read
at or beyond the offset maximum associated with the cor-
responding stream.
Page 1 Reliant UNIX 5.44 Printed 11/98
fgetws(3S) fgetws(3S)
The fgetws() function will fail if:
ENOMEM Insufficient storage space is available.
ENXIO A request was made of a non-existent device, or the
request was outside the capabilities of the device.
EILSEQ The data obtained from the input stream does not form a
valid character.
RESULT
Upon successful completion the fgetws() function returns ws. If the
stream is at end-of-file, the end-of-file indicator for the stream is
set and fgetws() returns a null pointer. If a read error occurs, the
error indicator for the stream is set, fgetws() returns a null pointer
and sets errno to indicate the error.
SEE ALSO
fopen(3S), fread(3S), lfs(5), wchar(5).
Page 2 Reliant UNIX 5.44 Printed 11/98