1UNGETWC(3P) POSIX Programmer's Manual UNGETWC(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 ungetwc — push wide-character code back into the input stream
14
16 #include <stdio.h>
17 #include <wchar.h>
18
19 wint_t ungetwc(wint_t wc, FILE *stream);
20
22 The functionality described on this reference page is aligned with the
23 ISO C standard. Any conflict between the requirements described here
24 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
25 defers to the ISO C standard.
26
27 The ungetwc() function shall push the character corresponding to the
28 wide-character code specified by wc back onto the input stream pointed
29 to by stream. The pushed-back characters shall be returned by subse‐
30 quent reads on that stream in the reverse order of their pushing. A
31 successful intervening call (with the stream pointed to by stream) to a
32 file-positioning function (fseek(), fseeko(), fsetpos(), or rewind())
33 or fflush() shall discard any pushed-back characters for the stream.
34 The external storage corresponding to the stream is unchanged.
35
36 At least one character of push-back shall be provided. If ungetwc() is
37 called too many times on the same stream without an intervening read or
38 file-positioning operation on that stream, the operation may fail.
39
40 If the value of wc equals that of the macro WEOF, the operation shall
41 fail and the input stream shall be left unchanged.
42
43 A successful call to ungetwc() shall clear the end-of-file indicator
44 for the stream. The value of the file-position indicator for the stream
45 after all pushed-back characters have been read, or discarded by call‐
46 ing fseek(), fseeko(), fsetpos(), or rewind() (but not fflush()), shall
47 be the same as it was before the characters were pushed back. The file-
48 position indicator is decremented (by one or more) by each successful
49 call to ungetwc(); if its value was 0 before a call, its value is
50 unspecified after the call.
51
53 Upon successful completion, ungetwc() shall return the wide-character
54 code corresponding to the pushed-back character. Otherwise, it shall
55 return WEOF.
56
58 The ungetwc() function may fail if:
59
60 EILSEQ An invalid character sequence is detected, or a wide-character
61 code does not correspond to a valid character.
62
63 The following sections are informative.
64
66 None.
67
69 None.
70
72 None.
73
75 None.
76
78 Section 2.5, Standard I/O Streams, fseek(), fsetpos(), read(),
79 rewind(), setbuf()
80
81 The Base Definitions volume of POSIX.1‐2008, <stdio.h>, <wchar.h>
82
84 Portions of this text are reprinted and reproduced in electronic form
85 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
86 -- Portable Operating System Interface (POSIX), The Open Group Base
87 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
88 cal and Electronics Engineers, Inc and The Open Group. (This is
89 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
90 event of any discrepancy between this version and the original IEEE and
91 The Open Group Standard, the original IEEE and The Open Group Standard
92 is the referee document. The original Standard can be obtained online
93 at http://www.unix.org/online.html .
94
95 Any typographical or formatting errors that appear in this page are
96 most likely to have been introduced during the conversion of the source
97 files to man page format. To report such errors, see https://www.ker‐
98 nel.org/doc/man-pages/reporting_bugs.html .
99
100
101
102IEEE/The Open Group 2013 UNGETWC(3P)