| 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 getwchar 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
getwchar \- read a wide character from standard input |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <wchar.h> |
| 16 |
.P |
| 17 |
.B "wint_t getwchar(void);" |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
The |
| 21 |
.BR getwchar () |
| 22 |
function is the wide-character equivalent of the |
| 23 |
.BR getchar (3) |
| 24 |
function. |
| 25 |
It reads a wide character from |
| 26 |
.I stdin |
| 27 |
and returns |
| 28 |
it. |
| 29 |
If the end of stream is reached, or if |
| 30 |
.I ferror(stdin) |
| 31 |
becomes true, it returns |
| 32 |
.BR WEOF . |
| 33 |
If a wide-character conversion error occurs, it sets |
| 34 |
.I errno |
| 35 |
to |
| 36 |
.B EILSEQ |
| 37 |
and returns |
| 38 |
.BR WEOF . |
| 39 |
.P |
| 40 |
For a nonlocking counterpart, see |
| 41 |
.BR unlocked_stdio (3). |
| 42 |
.SH RETURN VALUE |
| 43 |
The |
| 44 |
.BR getwchar () |
| 45 |
function returns the next wide-character from |
| 46 |
standard input, or |
| 47 |
.BR WEOF . |
| 48 |
.SH ATTRIBUTES |
| 49 |
For an explanation of the terms used in this section, see |
| 50 |
.BR attributes (7). |
| 51 |
.TS |
| 52 |
allbox; |
| 53 |
lbx lb lb |
| 54 |
l l l. |
| 55 |
Interface Attribute Value |
| 56 |
T{ |
| 57 |
.na |
| 58 |
.nh |
| 59 |
.BR getwchar () |
| 60 |
T} Thread safety MT-Safe |
| 61 |
.TE |
| 62 |
.SH STANDARDS |
| 63 |
C11, POSIX.1-2008. |
| 64 |
.SH HISTORY |
| 65 |
C99, POSIX.1-2001. |
| 66 |
.SH NOTES |
| 67 |
The behavior of |
| 68 |
.BR getwchar () |
| 69 |
depends on the |
| 70 |
.B LC_CTYPE |
| 71 |
category of the |
| 72 |
current locale. |
| 73 |
.P |
| 74 |
It is reasonable to expect that |
| 75 |
.BR getwchar () |
| 76 |
will actually |
| 77 |
read a multibyte sequence from standard input and then |
| 78 |
convert it to a wide character. |
| 79 |
.SH SEE ALSO |
| 80 |
.BR fgetwc (3), |
| 81 |
.BR unlocked_stdio (3) |