1fputwc(3C) Standard C Library Functions fputwc(3C)
2
3
4
6 fputwc, putwc, putwchar - put wide-character code on a stream
7
9 #include <stdio.h>
10 #include <wchar.h>
11
12 wint_t fputwc(wchar_t wc, FILE*stream);
13
14
15 wint_t putwc(wchar_t wc, FILE*stream);
16
17
18 #include <wchar.h>
19
20 wint_t putwchar(wchar_t wc);
21
22
24 The fputwc() function writes the character corresponding to the wide-
25 character code wc to the output stream pointed to by stream, at the
26 position indicated by the associated file-position indicator for the
27 stream (if defined), and advances the indicator appropriately. If the
28 file cannot support positioning requests, or if the stream was opened
29 with append mode, the character is appended to the output stream. If
30 an error occurs while writing the character, the shift state of the
31 output file is left in an undefined state.
32
33
34 The st_ctime and st_mtime fields of the file will be marked for update
35 between the successful execution of fputwc() and the next successful
36 completion of a call to fflush(3C) or fclose(3C) on the same stream or
37 a call to exit(2) or abort(3C).
38
39
40 The putwc() function is equivalent to fputwc(), except that it is
41 implemented as a macro.
42
43
44 The call putwchar(wc) is equivalent to putwc(wc, stdout). The
45 putwchar() routine is implemented as a macro.
46
48 Upon successful completion, fputwc(), putwc(), and putwchar() return
49 wc. Otherwise, they return WEOF, the error indicator for the stream is
50 set, and errno is set to indicate the error.
51
53 The fputwc(), putwc(), and putwchar() functions will fail if either the
54 stream is unbuffered or data in the stream's buffer needs to be writ‐
55 ten, and:
56
57 EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying
58 stream and the process would be delayed in the write opera‐
59 tion.
60
61
62 EBADF The file descriptor underlying stream is not a valid file
63 descriptor open for writing.
64
65
66 EFBIG An attempt was made to write to a file that exceeds the maxi‐
67 mum file size or the process's file size limit; or the file
68 is a regular file and an attempt was made to write at or
69 beyond the offset maximum associated with the corresponding
70 stream.
71
72
73 EINTR The write operation was terminated due to the receipt of a
74 signal, and no data was transferred.
75
76
77 EIO A physical I/O error has occurred, or the process is a member
78 of a background process group attempting to write to its con‐
79 trolling terminal, TOSTOP is set, the process is neither
80 ignoring nor blocking SIGTTOU, and the process group of the
81 process is orphaned.
82
83
84 ENOSPC There was no free space remaining on the device containing
85 the file.
86
87
88 EPIPE An attempt is made to write to a pipe or FIFO that is not
89 open for reading by any process. A SIGPIPE signal will also
90 be sent to the calling thread.
91
92
93
94 The fputwc(), putwc(), and putwchar() functions may fail if:
95
96 ENOMEM Insufficient storage space is available.
97
98
99 ENXIO A request was made of a non-existent device, or the request
100 was outside the capabilities of the device.
101
102
103 EILSEQ The wide-character code wc does not correspond to a valid
104 character.
105
106
108 Functions exist for the putwc() and putwchar() macros. To get the func‐
109 tion form, the macro name must be undefined (for example, #undef putc).
110
111
112 When the macro form is used, putwc() evaluates the stream argument more
113 than once. In particular, putwc(wc, *f++) does not work sensibly. The
114 fputwc() function should be used instead when evaluating the stream
115 argument has side effects.
116
118 See attributes(5) for descriptions of the following attributes:
119
120
121
122
123 ┌─────────────────────────────┬─────────────────────────────┐
124 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
125 ├─────────────────────────────┼─────────────────────────────┤
126 │Interface Stability │Standard │
127 ├─────────────────────────────┼─────────────────────────────┤
128 │MT-Level │MT-Safe │
129 └─────────────────────────────┴─────────────────────────────┘
130
132 exit(2), ulimit(2), abort(3C), fclose(3C), ferror(3C), fflush(3C),
133 fopen(3C), setbuf(3C), attributes(5), standards(5)
134
135
136
137SunOS 5.11 1 Nov 2003 fputwc(3C)