fgetwc

Returns the next wide-character code from the input stream.

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <wchar.h> 
   
  wint_t  fgetwc (
     struct _iobuf   *fp);
  

Parameters

fp

(IN) Points to the file.

Return Values

If successful, returns the next wide-character code, converted to type wint_t, from the input stream pointed to by fp. If the stream is at end-of-file, sets the error indicator for the stream and returns WEOF. If a read or encoding error occurs, fgetwc returns WEOF, sets the error indicator for the stream, and sets errno to one of the following:

Decimal

Constant

Description

4

EBADF

The file descriptor is not valid for reading.

5

ENOMEM

Insufficient storage space is available.

24

EAGAIN

The O_NONBLOCK flag is set for the file descriptor, and the process cannot immediately perform the read operation.

25

ENXIO

A request was made to a nonexistent device, or the request was outside the capabilities of the device.

28

EIO

The process is orphaned and cannot write to the file.

63

EINTR

A signal interrupted the read operation.

81

EOVERFLOW

The file is a regular file and an attempt was made to read at or beyond the offset maximum associated with the corresponding stream.

101

EILSEQ

A wide-character code does not correspond to a valid sequence.

Remarks

The fgetwc function obtains the next character (if present) from the input stream pointed to by fp, converts it to the corresponding wide-character code, and advances the associated file position indicator for the stream.

See Also