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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       fgetwc — get a wide-character code from a stream
13

SYNOPSIS

15       #include <stdio.h>
16       #include <wchar.h>
17
18       wint_t fgetwc(FILE *stream);
19

DESCRIPTION

21       The functionality described on this reference page is aligned with  the
22       ISO C  standard.  Any  conflict between the requirements described here
23       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
24       defers to the ISO C standard.
25
26       The fgetwc() function shall obtain the next character (if present) from
27       the input stream pointed to by stream, convert that to the  correspond‐
28       ing wide-character code, and advance the associated file position indi‐
29       cator for the stream (if defined).
30
31       If an error occurs, the resulting value of the file position  indicator
32       for the stream is unspecified.
33
34       The  fgetwc()  function  may mark the last data access timestamp of the
35       file associated with stream for update. The last data access  timestamp
36       shall  be  marked  for  update  by  the  first  successful execution of
37       fgetwc(), fgetws(), fwscanf(), getwc(),  getwchar(),  vfwscanf(),  vws‐
38       canf(),  or  wscanf()  using stream that returns data not supplied by a
39       prior call to ungetwc().
40
41       The fgetwc() function shall not change the setting of errno if success‐
42       ful.
43

RETURN VALUE

45       Upon  successful  completion,  the  fgetwc()  function shall return the
46       wide-character code of the character read from the input stream pointed
47       to  by stream converted to a type wint_t.  If the end-of-file indicator
48       for the stream is set, or if the stream is at end-of-file, the  end-of-
49       file  indicator  for  the stream shall be set and fgetwc() shall return
50       WEOF. If a read error occurs, the error indicator for the stream  shall
51       be set, fgetwc() shall return WEOF, and shall set errno to indicate the
52       error.  If an encoding error occurs, the error indicator for the stream
53       shall  be set, fgetwc() shall return WEOF, and shall set errno to indi‐
54       cate the error.
55

ERRORS

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

EXAMPLES

94       None.
95

APPLICATION USAGE

97       The ferror() or feof() functions must be used to distinguish between an
98       error condition and an end-of-file condition.
99

RATIONALE

101       None.
102

FUTURE DIRECTIONS

104       None.
105

SEE ALSO

107       Section 2.5, Standard I/O Streams, feof(), ferror(), fopen()
108
109       The Base Definitions volume of POSIX.1‐2017, <stdio.h>, <wchar.h>
110
112       Portions of this text are reprinted and reproduced in  electronic  form
113       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
114       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
115       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
116       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
117       event of any discrepancy between this version and the original IEEE and
118       The Open Group Standard, the original IEEE and The Open Group  Standard
119       is  the  referee document. The original Standard can be obtained online
120       at http://www.opengroup.org/unix/online.html .
121
122       Any typographical or formatting errors that appear  in  this  page  are
123       most likely to have been introduced during the conversion of the source
124       files to man page format. To report such errors,  see  https://www.ker
125       nel.org/doc/man-pages/reporting_bugs.html .
126
127
128
129IEEE/The Open Group                  2017                           FGETWC(3P)
Impressum