Reads the next character from a specified file, and converts it to a wide-character code. Format #include <wchar.h> wint_t fgetwc (FILE *file_ptr);
1 – Argument
file_ptr A pointer to the file to be accessed.
2 – Description
Upon successful completion, the fgetwc function returns the wide- character code read from the file pointed to by file_ptr and converted to type wint_t. If the file is at end-of-file, the end-of-file indicator is set, and WEOF is returned. If an I/O read error occurred, then the error indicator is set, and WEOF is returned. Applications can use ferror or feof to distinguish between an error condition and an end-of-file condition.
3 – Return Values
x The wide-character code of the character read. WEOF Indicates the end-of-file or an error. If a read error occurs, the function sets errno to one of the following: o EALREADY - An operation is already in progress on the same file. o EBADF - The file descriptor is not valid. o EILSEQ - Invalid character detected.