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
11

NAME

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

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

95       None.
96

APPLICATION USAGE

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

RATIONALE

102       None.
103

FUTURE DIRECTIONS

105       None.
106

SEE ALSO

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