1FGETWC(P)                  POSIX Programmer's Manual                 FGETWC(P)
2
3
4

NAME

6       fgetwc - get a wide-character code from a stream
7

SYNOPSIS

9       #include <stdio.h>
10       #include <wchar.h>
11
12       wint_t fgetwc(FILE *stream);
13
14

DESCRIPTION

16       The fgetwc() function shall obtain the next character (if present) from
17       the input stream pointed to by stream, convert that to the  correspond‐
18       ing wide-character code, and advance the associated file position indi‐
19       cator for the stream (if defined).
20
21       If an error occurs, the resulting value of the file position  indicator
22       for the stream is unspecified.
23
24       The  fgetwc()  function may mark the st_atime field of the file associ‐
25       ated with stream for update. The st_atime field  shall  be  marked  for
26       update by the first successful execution of fgetc(), fgets(), fgetwc(),
27       fgetws(), fread(), fscanf(),  getc(),  getchar(),  gets(),  or  scanf()
28       using stream that returns data not supplied by a prior call to ungetc()
29       or ungetwc().
30

RETURN VALUE

32       Upon successful completion, the  fgetwc()  function  shall  return  the
33       wide-character code of the character read from the input stream pointed
34       to by stream converted to a type wint_t.  If the stream is  at  end-of-
35       file,  the  end-of-file  indicator  for  the  stream  shall  be set and
36       fgetwc() shall return WEOF. If a read error occurs, the error indicator
37       for  the  stream shall be set, fgetwc() shall return WEOF,    and shall
38       set errno to indicate the error.  If  an  encoding  error  occurs,  the
39       error  indicator  for  the  stream  shall be set, fgetwc() shall return
40       WEOF, and shall set errno to indicate the error.
41

ERRORS

43       The fgetwc() function shall fail if data needs to be read and:
44
45       EAGAIN The O_NONBLOCK flag is set for the  file  descriptor  underlying
46              stream  and  the process would be delayed in the fgetwc() opera‐
47              tion.
48
49       EBADF  The file descriptor  underlying  stream  is  not  a  valid  file
50              descriptor open for reading.
51
52       EILSEQ The  data  obtained  from the input stream does not form a valid
53              character.
54
55       EINTR  The read operation was terminated due to the receipt of  a  sig‐
56              nal, and no data was transferred.
57
58       EIO    A  physical I/O error has occurred, or the process is in a back‐
59              ground process group attempting to  read  from  its  controlling
60              terminal,  and  either  the  process is ignoring or blocking the
61              SIGTTIN signal or the process group is orphaned. This error  may
62              also be generated for implementation-defined reasons.
63
64       EOVERFLOW
65              The file is a regular file and an attempt was made to read at or
66              beyond the offset  maximum  associated  with  the  corresponding
67              stream.
68
69
70       The fgetwc() function may fail if:
71
72       ENOMEM Insufficient storage space is available.
73
74       ENXIO  A  request  was made of a nonexistent device, or the request was
75              outside the capabilities of the device.
76
77
78       The following sections are informative.
79

EXAMPLES

81       None.
82

APPLICATION USAGE

84       The ferror() or feof() functions must be used to distinguish between an
85       error condition and an end-of-file condition.
86

RATIONALE

88       None.
89

FUTURE DIRECTIONS

91       None.
92

SEE ALSO

94       feof()   ,  ferror()  ,  fopen()  ,  the  Base  Definitions  volume  of
95       IEEE Std 1003.1-2001, <stdio.h>, <wchar.h>
96
98       Portions of this text are reprinted and reproduced in  electronic  form
99       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
100       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
101       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
102       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
103       event of any discrepancy between this version and the original IEEE and
104       The Open Group Standard, the original IEEE and The Open Group  Standard
105       is  the  referee document. The original Standard can be obtained online
106       at http://www.opengroup.org/unix/online.html .
107
108
109
110IEEE/The Open Group                  2003                            FGETWC(P)
Impressum