fgetws()

get UNICODE character string from stream 

Function


SYNOPSIS

#include <stdio.h>

#include <wchar.h>

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


DESCRIPTION

The fgetws() function reads at most n-1 characters from stream into the wide character array pointed to by ws. No additional characters are read after fgetws() has read and transferred a newline character to the buffer. A null character is written immediately after the last character that fgetws() reads into the buffer.

Function fgetws() loads array ws with UNICODE characters. If stream is open in binary mode, then fgetws() simply reads UNICODE characters from the input stream. Otherwise, if stream is open in text mode, fgetws() translates the input from multibyte format to UNICODE.


PARAMETERS

ws 

Points to a buffer that is to hold the characters read.

n 

Is the maximum number of elements to read into the array pointed to by ws.

stream 

Is the stream from which the characters are read.


RETURN VALUES

If successful, fgetws() returns ws, the address of the input buffer. If end-of-file is encountered and no characters have been read into the buffer, the buffer's contents remain unchanged and a null pointer is returned. If a read error occurs, a null pointer is returned and the error indicator for the stream is set. The functions ferror() and feof() can be used to distinguish error conditions from end-of-file.

On failure, errno is set to one of the following values:

EACCES 

Another process has the file locked.

EBADF 

stream is not a valid stream opened for reading.

EILSEQ 

An unrecognizable character code was encountered.

EINTR 

A signal interrupted the call.

EIO 

An input error occurred.

EISDIR 

The open object is a directory, not a file.

ENOMEM 

Memory could not be allocated for internal buffers.

ENXIO 

A device error occurred.

EOVERFLOW 

The file is a regular file and an attempt was made to read at or beyond the offset maximum associated with the corresponding stream.

EWOULDBLOCK 

The underlying file descriptor is a non-blocking socket and no data is ready to be read.


CONFORMANCE

UNIX 98.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

For files open in text mode, the character sequence carriage-return linefeed is translated into linefeed. No such translation occurs for files open in binary mode.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
feof(), ferror(), fgets(), fgetwc(), fopen(), getw()


PTC MKS Toolkit 10.4 Documentation Build 39.