Next: , Previous: fgetwc, Up: Stdio


4.14 fgetws—get wide character string from a file or stream

Synopsis

     #include <wchar.h>
     wchar_t *fgetws(wchar_t *ws, int n, FILE *fp);
     
     #include <wchar.h>
     wchar_t *_fgetws_r(struct _reent *ptr, wchar_t *ws, int n, FILE *fp);
     

Description
Reads at most n-1 wide characters from fp until a newline is found. The wide characters including to the newline are stored in ws. The buffer is terminated with a 0.

The _fgetws_r function is simply the reentrant version of fgetws and is passed an additional reentrancy structure pointer: ptr.


Returns
fgetws returns the buffer passed to it, with the data filled in. If end of file occurs with some data already accumulated, the data is returned with no other indication. If no data are read, NULL is returned instead.


Portability
C99, POSIX.1-2001