The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


fgetws - get a wide-character string from a stream


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

wchar_t *fgetws(wchar_t *ws, int n, FILE *stream);


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().


Upon successful completion, fgetws() 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.


Refer to fgetwc().








fopen(), fread(), <stdio.h>, <wchar.h>.


Derived from the MSE working draft.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]