Debian Codegraph @

upstream/debian-unstable/man3/ungetwc.3

raw
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 ungetwc 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 ungetwc \- push back a wide character onto a FILE stream
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <wchar.h>
16 .P
17 .BI "wint_t ungetwc(wint_t " wc ", FILE *" stream );
18 .fi
19 .SH DESCRIPTION
20 The
21 .BR ungetwc ()
22 function is the wide-character equivalent of the
23 .BR ungetc (3)
24 function.
25 It pushes back a wide character onto
26 .I stream
27 and returns it.
28 .P
29 If
30 .I wc
31 is
32 .BR WEOF ,
33 it returns
34 .BR WEOF .
35 If
36 .I wc
37 is an invalid wide character,
38 it sets
39 .I errno
40 to
41 .B EILSEQ
42 and returns
43 .BR WEOF .
44 .P
45 If
46 .I wc
47 is a valid wide character,
48 it is pushed back onto the stream
49 and thus becomes available for future wide-character read operations.
50 The file-position indicator is decremented by one or more.
51 The end-of-file indicator is cleared.
52 The backing storage of the file is not affected.
53 .P
54 Note:
55 .I wc
56 need not be the last wide-character read from the stream;
57 it can be any other valid wide character.
58 .P
59 If the implementation supports multiple push-back operations in a row,
60 the pushed-back wide characters will be read in reverse order;
61 however,
62 only one level of push-back is guaranteed.
63 .SH RETURN VALUE
64 The
65 .BR ungetwc ()
66 function returns
67 .I wc
68 when successful, or
69 .B WEOF
70 upon
71 failure.
72 .SH ATTRIBUTES
73 For an explanation of the terms used in this section, see
74 .BR attributes (7).
75 .TS
76 allbox;
77 lbx lb lb
78 l l l.
79 Interface Attribute Value
80 T{
81 .na
82 .nh
83 .BR ungetwc ()
84 T} Thread safety MT-Safe
85 .TE
86 .SH STANDARDS
87 C11, POSIX.1-2008.
88 .SH HISTORY
89 POSIX.1-2001, C99.
90 .SH NOTES
91 The behavior of
92 .BR ungetwc ()
93 depends on the
94 .B LC_CTYPE
95 category of the
96 current locale.
97 .SH SEE ALSO
98 .BR fgetwc (3)