1FGETWC(3P) POSIX Programmer's Manual FGETWC(3P)
2
3
4
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
12 fgetwc - get a wide-character code from a stream
13
15 #include <stdio.h>
16 #include <wchar.h>
17
18 wint_t fgetwc(FILE *stream);
19
20
22 The fgetwc() function shall obtain the next character (if present) from
23 the input stream pointed to by stream, convert that to the correspond‐
24 ing wide-character code, and advance the associated file position indi‐
25 cator for the stream (if defined).
26
27 If an error occurs, the resulting value of the file position indicator
28 for the stream is unspecified.
29
30 The fgetwc() function may mark the st_atime field of the file associ‐
31 ated with stream for update. The st_atime field shall be marked for
32 update by the first successful execution of fgetc(), fgets(), fgetwc(),
33 fgetws(), fread(), fscanf(), getc(), getchar(), gets(), or scanf()
34 using stream that returns data not supplied by a prior call to ungetc()
35 or ungetwc().
36
38 Upon successful completion, the fgetwc() function shall return the
39 wide-character code of the character read from the input stream pointed
40 to by stream converted to a type wint_t. If the stream is at end-of-
41 file, the end-of-file indicator for the stream shall be set and
42 fgetwc() shall return WEOF. If a read error occurs, the error indicator
43 for the stream shall be set, fgetwc() shall return WEOF, and shall set
44 errno to indicate the error. If an encoding error occurs, the error
45 indicator for the stream shall be set, fgetwc() shall return WEOF, and
46 shall set errno to indicate the error.
47
49 The fgetwc() function shall fail if data needs to be read and:
50
51 EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying
52 stream and the process would be delayed in the fgetwc() opera‐
53 tion.
54
55 EBADF The file descriptor underlying stream is not a valid file
56 descriptor open for reading.
57
58 EILSEQ The data obtained from the input stream does not form a valid
59 character.
60
61 EINTR The read operation was terminated due to the receipt of a sig‐
62 nal, and no data was transferred.
63
64 EIO A physical I/O error has occurred, or the process is in a back‐
65 ground process group attempting to read from its controlling
66 terminal, and either the process is ignoring or blocking the
67 SIGTTIN signal or the process group is orphaned. This error may
68 also be generated for implementation-defined reasons.
69
70 EOVERFLOW
71 The file is a regular file and an attempt was made to read at or
72 beyond the offset maximum associated with the corresponding
73 stream.
74
75
76 The fgetwc() function may fail if:
77
78 ENOMEM Insufficient storage space is available.
79
80 ENXIO A request was made of a nonexistent device, or the request was
81 outside the capabilities of the device.
82
83
84 The following sections are informative.
85
87 None.
88
90 The ferror() or feof() functions must be used to distinguish between an
91 error condition and an end-of-file condition.
92
94 None.
95
97 None.
98
100 feof(), ferror(), fopen(), the Base Definitions volume of
101 IEEE Std 1003.1-2001, <stdio.h>, <wchar.h>
102
104 Portions of this text are reprinted and reproduced in electronic form
105 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
106 -- Portable Operating System Interface (POSIX), The Open Group Base
107 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
108 Electrical and Electronics Engineers, Inc and The Open Group. In the
109 event of any discrepancy between this version and the original IEEE and
110 The Open Group Standard, the original IEEE and The Open Group Standard
111 is the referee document. The original Standard can be obtained online
112 at http://www.opengroup.org/unix/online.html .
113
114
115
116IEEE/The Open Group 2003 FGETWC(3P)