Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

getwc - Read a wide character from a file

&pagelevel(4)&pagelevel

Definition

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

wint_t getwc(FILE *fp);

getwc is equivalent to fgetwc, except for the fact that it is implemented as a macro and
can evaluate fp more than once, so the argument should never be an expression with side
effects.

Return val.

Wide character code of type wint_t


if successful.

WEOF

if the 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.

getwc is implemented both as a function and as a macro (see section “Functions and macros”).

This interface was provided to support some current implementations and possible future
ISO standards.

If getwc is used as a macro, an fp expression with side effects may be handled incorrectly.
In particular, getwc(*f++) may not work as expected. For this reason, it is better to use
fgetwc in such situations instead of getwc.

You can satisfy the WEOF condition when reading from the terminal by means of the
following actions: pressing the K2 key and entering the system commands EOF and
RESUME-PROGRAM.

See also

fgetwc, getc