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
12 ungetwc - push wide-character code back into the input stream
13
15 #include <stdio.h>
16 #include <wchar.h>
17
18 wint_t ungetwc(wint_t wc, FILE *stream);
19
20
22 The ungetwc() function shall push the character corresponding to the
23 wide-character code specified by wc back onto the input stream pointed
24 to by stream. The pushed-back characters shall be returned by subse‐
25 quent reads on that stream in the reverse order of their pushing. A
26 successful intervening call (with the stream pointed to by stream) to a
27 file-positioning function ( fseek(), fsetpos(), or rewind()) discards
28 any pushed-back characters for the stream. The external storage corre‐
29 sponding to the stream is unchanged.
30
31 At least one character of push-back shall be provided. If ungetwc() is
32 called too many times on the same stream without an intervening read or
33 file-positioning operation on that stream, the operation may fail.
34
35 If the value of wc equals that of the macro WEOF, the operation shall
36 fail and the input stream shall be left unchanged.
37
38 A successful call to ungetwc() shall clear the end-of-file indicator
39 for the stream. The value of the file-position indicator for the stream
40 after reading or discarding all pushed-back characters shall be the
41 same as it was before the characters were pushed back. The file-posi‐
42 tion indicator is decremented (by one or more) by each successful call
43 to ungetwc(); if its value was 0 before a call, its value is unspeci‐
44 fied after the call.
45
47 Upon successful completion, ungetwc() shall return the wide-character
48 code corresponding to the pushed-back character. Otherwise, it shall
49 return WEOF.
50
52 The ungetwc() function may fail if:
53
54 EILSEQ An invalid character sequence is detected, or a wide-character
55 code does not correspond to a valid character.
56
57
58 The following sections are informative.
59
61 None.
62
64 None.
65
67 None.
68
70 None.
71
73 fseek(), fsetpos(), read(), rewind(), setbuf(), the Base Definitions
74 volume of IEEE Std 1003.1-2001, <stdio.h>, <wchar.h>
75
77 Portions of this text are reprinted and reproduced in electronic form
78 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
79 -- Portable Operating System Interface (POSIX), The Open Group Base
80 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
81 Electrical and Electronics Engineers, Inc and The Open Group. In the
82 event of any discrepancy between this version and the original IEEE and
83 The Open Group Standard, the original IEEE and The Open Group Standard
84 is the referee document. The original Standard can be obtained online
85 at http://www.opengroup.org/unix/online.html .
86
87
88
89IEEE/The Open Group 2003 UNGETWC(3P)