| 1 |
'\" t |
| 2 |
.\" Copyright, Bruno Haible <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH fputwc 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
fputwc, putwc \- write a wide character to a FILE stream |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <stdio.h> |
| 16 |
.B #include <wchar.h> |
| 17 |
.P |
| 18 |
.BI "wint_t fputwc(wchar_t " wc ", FILE *" stream ); |
| 19 |
.BI "wint_t putwc(wchar_t " wc ", FILE *" stream ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
The |
| 23 |
.BR fputwc () |
| 24 |
function is the wide-character |
| 25 |
equivalent of the |
| 26 |
.BR fputc (3) |
| 27 |
function. |
| 28 |
It writes the wide character |
| 29 |
.I wc |
| 30 |
to |
| 31 |
.IR stream . |
| 32 |
If |
| 33 |
.I ferror(stream) |
| 34 |
becomes true, it returns |
| 35 |
.BR WEOF . |
| 36 |
If a wide-character conversion error occurs, |
| 37 |
it sets |
| 38 |
.I errno |
| 39 |
to |
| 40 |
.B EILSEQ |
| 41 |
and returns |
| 42 |
.BR WEOF . |
| 43 |
Otherwise, it returns |
| 44 |
.IR wc . |
| 45 |
.P |
| 46 |
The |
| 47 |
.BR putwc () |
| 48 |
function or macro functions identically to |
| 49 |
.BR fputwc (). |
| 50 |
It may be implemented as a macro, and may evaluate its argument |
| 51 |
more than once. |
| 52 |
There is no reason ever to use it. |
| 53 |
.P |
| 54 |
For nonlocking counterparts, see |
| 55 |
.BR unlocked_stdio (3). |
| 56 |
.SH RETURN VALUE |
| 57 |
On success, |
| 58 |
.BR fputwc () |
| 59 |
function returns |
| 60 |
.IR wc . |
| 61 |
Otherwise, |
| 62 |
.B WEOF |
| 63 |
is returned, and |
| 64 |
.I errno |
| 65 |
is set to indicate the error. |
| 66 |
.SH ERRORS |
| 67 |
Apart from the usual ones, there is |
| 68 |
.TP |
| 69 |
.B EILSEQ |
| 70 |
Conversion of |
| 71 |
.I wc |
| 72 |
to the stream's encoding fails. |
| 73 |
.SH ATTRIBUTES |
| 74 |
For an explanation of the terms used in this section, see |
| 75 |
.BR attributes (7). |
| 76 |
.TS |
| 77 |
allbox; |
| 78 |
lbx lb lb |
| 79 |
l l l. |
| 80 |
Interface Attribute Value |
| 81 |
T{ |
| 82 |
.na |
| 83 |
.nh |
| 84 |
.BR fputwc (), |
| 85 |
.BR putwc () |
| 86 |
T} Thread safety MT-Safe |
| 87 |
.TE |
| 88 |
.SH STANDARDS |
| 89 |
C11, POSIX.1-2008. |
| 90 |
.SH HISTORY |
| 91 |
C99, POSIX.1-2001. |
| 92 |
.SH NOTES |
| 93 |
The behavior of |
| 94 |
.BR fputwc () |
| 95 |
depends on the |
| 96 |
.B LC_CTYPE |
| 97 |
category of the |
| 98 |
current locale. |
| 99 |
.P |
| 100 |
In the absence of additional information passed to the |
| 101 |
.BR fopen (3) |
| 102 |
call, it is |
| 103 |
reasonable to expect that |
| 104 |
.BR fputwc () |
| 105 |
will actually write the multibyte |
| 106 |
sequence corresponding to the wide character |
| 107 |
.IR wc . |
| 108 |
.SH SEE ALSO |
| 109 |
.BR fgetwc (3), |
| 110 |
.BR fputws (3), |
| 111 |
.BR unlocked_stdio (3) |