1fgetwc(3C) Standard C Library Functions fgetwc(3C)
2
3
4
6 fgetwc - get a wide-character code from a stream
7
9 #include <stdio.h>
10 #include <wchar.h>
11
12 wint_t fgetwc(FILE*stream);
13
14
16 The fgetwc() function obtains the next character (if present) from the
17 input stream pointed to by stream, converts that to the corresponding
18 wide-character code and advances the associated file position indicator
19 for the stream (if defined).
20
21
22 If an error occurs, the resulting value of the file position indicator
23 for the stream is indeterminate.
24
25
26 The fgetwc() function may mark the st_atime field of the file associ‐
27 ated with stream for update. The st_atime field will be marked for
28 update by the first successful execution of fgetwc(), fgetc(3C),
29 fgets(3C), fgetws(3C), fread(3C), fscanf(3C), getc(3C), getchar(3C),
30 gets(3C), or scanf(3C) using stream that returns data not supplied by a
31 prior call to ungetc(3C) or ungetwc(3C).
32
34 Upon successful completion the fgetwc() function returns the wide-char‐
35 acter code of the character read from the input stream pointed to by
36 stream converted to a type wint_t.
37
38
39 For standard-conforming (see standards(5)) applications, if the end-of-
40 file indicator for the stream is set, fgetwc() returns WEOF whether or
41 not the stream is at end-of-file.
42
43
44 If a read error occurs, the error indicator for the stream is set,
45 fgetwc() returns WEOF and sets errno to indicate the error.
46
47
48 If an encoding error occurs, the error indicator for the stream is set,
49 fgetwc() returns WEOF, and errno is set to indicate the error.
50
52 The fgetwc() function will fail if data needs to be read and:
53
54 EAGAIN The O_NONBLOCK flag is set for the file descriptor under‐
55 lying stream and the process would be delayed in the
56 fgetwc() operation.
57
58
59 EBADF The file descriptor underlying stream is not a valid file
60 descriptor open for reading.
61
62
63 EINTR The read operation was terminated due to the receipt of a
64 signal, and no data was transferred.
65
66
67 EIO A physical I/O error has occurred, or the process is in a
68 background process group attempting to read from its con‐
69 trolling terminal and either the process is ignoring or
70 blocking the SIGTTIN signal or the process group is
71 orphaned.
72
73
74 EOVERFLOW The file is a regular file and an attempt was made to
75 read at or beyond the offset maximum associated with the
76 corresponding stream.
77
78
79
80 The fgetwc() function may fail if:
81
82 ENOMEM Insufficient storage space is available.
83
84
85 ENXIO A request was made of a non-existent device, or the request
86 was outside the capabilities of the device.
87
88
89 EILSEQ The data obtained from the input stream does not form a valid
90 character.
91
92
94 The ferror(3C) or feof(3C) functions must be used to distinguish
95 between an error condition and an end-of-file condition.
96
98 See attributes(5) for descriptions of the following attributes:
99
100
101
102
103 ┌─────────────────────────────┬─────────────────────────────┐
104 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
105 ├─────────────────────────────┼─────────────────────────────┤
106 │CSI │Enabled │
107 ├─────────────────────────────┼─────────────────────────────┤
108 │Interface Stability │Standard │
109 ├─────────────────────────────┼─────────────────────────────┤
110 │MT-Level │MT-Safe with exceptions │
111 └─────────────────────────────┴─────────────────────────────┘
112
114 feof(3C), ferror(3C), fgetc(3C), fgets(3C), fgetws(3C), fopen(3C),
115 fread(3C), fscanf(3C), getc(3C), getchar(3C), gets(3C), scanf(3C), set‐
116 locale(3C), ungetc(3C), ungetwc(3C), attributes(5), standards(5)
117
118
119
120SunOS 5.11 15 Oct 2003 fgetwc(3C)