Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

fgetwc - Read a wide character from input stream

&pagelevel(4)&pagelevel

Definition

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

wint_t fgetwc(FILE *fp);

fgetwc reads the next character from the file with the file pointer fp, converts it to the
corresponding wide character code, and advances the associated file position indicator for
the file (if defined).

If an error occurs, the resulting value of the file position indicator is undefined.

If fgetwc is reading from the standard input stdin, and WEOF is the end criterion for
reading, you can satisfy the WEOF condition by means of the following actions at the
terminal: pressing the K2 key and entering the system commands EOF and RESUME-
PROGRAM.

Return val.

Value of the read wide character as a wint_t value

if successful.

WEOF

if end-of-file is reached. The end-of-file indicator for the file is set;
or
if a read error occurs. The error indicator for the file is set, and errno is set
to EBADF if fp is an invalid file pointer.

Notes

This version of the C runtime system only supports one-byte characters as wide character
codes.

The ferror or feof functions must be used to distinguish between an error condition and
an end-of-file condition.

The following applies in the case of text files with SAM access mode and variable record
length for which a maximum record length is also specified: When the specification
split=no was entered for fopen, records of maximum record length are not concatenated
with the subsequent record when they are read. By default or with the specification
split=yes, when a record with maximum record length is read, it is assumed that the
following record is the continuation of this record and the records are concatenated.

See also

feof, ferror, fgetc, fopen, fopen64