|HP-UX Reference > F
HP-UX 11i Version 3: February 2007
fgetws(), fgetws_unlocked() — get a wide-character string from a stream file
wchar_t *fgetws(wchar_t *__restrict ws, int n, FILE *__restrict stream);
fgetws() is compliant with the XPG4 Worldwide Portability Interface wide-character I/O functions. It parallels the 8-bit character I/O function defined in gets(3S).
The definition for this functions and the type wchar_t are provided in the <wchar.h> header.
After fgetws() is applied to a stream, the stream becomes wide-oriented (see orientation(5)).
Upon successful completion, fgetws() and fgetws_unlocked() return ws. If the stream is at end-of-file, the end-of-file indicator for the stream is set and a null pointer is returned.
When the file corresponding to the open stream gets extended after the end-of-file is reached, all subsequent calls to these functions will succeed and the end-of-file indicator will remain set. However, in the UNIX2003 standards environment (see standards(5)), these functions will fail, and they will return a null pointer; the end-of-file indicator will still remain set.
If a read error occurs, the error indicator for the stream is set, errno is set to indicate the error, and a null pointer is returned.
ferror() or feof() can be used to distinguish between an error condition and an end-of-file condition.
If fgetws() or fgetws_unlocked() fails if data needs to be read into the stream's buffer and another error occurs, errno is set to one of the following:
Additional errno values can be set by the underlying read() function (see read(2)).
fgetws_unlocked() is an obsolescent interface supported only for compatibility with existing DCE applications. New multithreaded applications should use fgetws().