Syntax | #include <wchar.h> Optional #include <stdio.h> (End) wint_t fgetwc(FILE *stream); |
Description | Description fgetwc() reads the next character (if present) from the input stream pointed to by stream, converts that to the corresponding wide character code and advances the file position indicator for the stream (if defined). If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. fgetwc() can mark the structure component st_atime for the file to which stream is assigned for changing (see sys/stat.h ). The structure component st_atime is updated as soon as fgetc() , fgets() , fgetwc() , fgetws() , fread() , fscanf() , getc() , getchar() , gets() or scanf() are called successfully for stream and return data which is not was not provided by a preceding call to ungetc() or ungetwc() .
Restriction This version of the C runtime system only supports 1-byte characters as wide character codes. They are of type wchar_t (see stddef.h ). |
Return val. | Wide character code of type wint_t |
|
| upon successful completion. |
| WEOF
| if the stream is at end-of-file. The end-of-file indicator for the stream is set. |
| WEOF
| if a read error occurs. The error indicator for the stream is set, and errno is set to indicate the error. |
Errors | fgetwc() will fail if:
|
| EAGAIN
| The O_NONBLOCK flag is set for the file descriptor underlying stream, and the process would be delayed in the fgetc() operation. |
| EBADF
| The file descriptor underlying stream is not a valid file descriptor open for reading. |
| EINTR
| The read operation was terminated due to the receipt of a signal, and no data was transferred. |
| Extension
|
| EINVAL
| An attempt was made to access a BS2000 file (End) |
| EIO
| The process is a member in a background process group attempting to read from its controlling terminal, and either the process is ignoring or blocking the SIGTTIN signal or the process group is orphaned. |
Notes | In this version of the runtime system the wide character functions are only supported for UFS files. ferror() or feof() must be used to distinguish between an error condition and an end-of-file condition.
BS2000 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 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 (End). |
See also | feof() , ferror() , fgetc() , fopen() , stdio.h , wchar.h .
|