fgetws(3C)


fgetws -- get a wchar_t string from a stream

Synopsis

   #include <stdio.h>
   #include <wchar.h>
   

wchar_t *fgetws(wchar_t *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 wchar_t 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 terminated 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 st_atime field of the file associated with stream for update. The st_atime field will be marked for update by the first successful execution of fgetc, fgets, fgetwc, fgetws, fread, fscanf, getc, getchar, gets, or scanf using stream that returns data not supplied by a prior call to ungetc or ungetwc.

Return value

Upon successful completion, fgetws returns ws. If stream is at end-of-file, the end-of-file indicator for stream is set and fgetws returns a NULL pointer. If a read error occurs, the error indicator for stream is set, fgetws returns a NULL pointer, and errno is set to indicate the error.

Errors

See fgetwc(3S).

References

ferror(3S), fopen(3S), fread(3S), fscanf(3S), getwc(3S), getws(3wide), Intro(3S), widec(3S)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004