Input subroutines

The wint_t data type is required to represent the wide character code value as well as the end-of-file (EOF) marker. For example, consider the case of the fgetwc subroutine, which returns a wide character code value:

Subroutine return value declaration Description
wchar_t fgetwc(); If the wchar_t data type is defined as a char value, the y-umlaut symbol cannot be distinguished from the end-of-file (EOF) marker in the ISO8859-1 code set. The 0xFF code point is a valid character (y umlaut). Hence, the return value cannot be the wchar_t data type. A data type is needed that can hold both the EOF marker and all the code points in a code set.
int fgetwc(); On some machines, the int data type is defined to be 16 bits. When the wchar_t data type is larger than 16 bits, the int value cannot represent all the return values.

The wint_t data type is therefore needed to represent the fgetwc subroutine return value. The wint_t data type is defined in the wchar.h file.

Subroutine return value Description
fgetwc Gets next wide character from a stream.
fgetws Gets a string of wide characters from a stream.
getwc Gets next wide character from a stream.
getwchar Gets next wide character from standard input.
getws Gets a string of wide characters from a standard input.
ungetwc Pushes a wide character onto a stream.