1ungetwc(3C) Standard C Library Functions ungetwc(3C)
2
3
4
6 ungetwc - push wide-character code back into input stream
7
9 #include <stdio.h>
10 #include <wchar.h>
11
12 wint_t ungetwc(wint_t wc, FILE *stream);
13
14
16 The ungetwc() function pushes the character corresponding to the wide
17 character code specified by wc back onto the input stream pointed to by
18 stream. The pushed-back characters will be returned by subsequent reads
19 on that stream in the reverse order of their pushing. A successful
20 intervening call (with the stream pointed to by stream) to a file-posi‐
21 tioning function ( fseek(3C), fsetpos(3C) or rewind(3C)) discards any
22 pushed-back characters for the stream. The external storage correspond‐
23 ing to the stream is unchanged.
24
25
26 One character of push-back is guaranteed. If ungetwc() is called too
27 many times on the same stream without an intervening read or file-posi‐
28 tioning operation on that stream, the operation may fail.
29
30
31 If the value of wc equals that of the macro WEOF, the operation fails
32 and the input stream is unchanged.
33
34
35 A successful call to ungetwc() clears the end-of-file indicator for the
36 stream. The value of the file-position indicator for the stream after
37 reading or discarding all pushed-back characters will be the same as it
38 was before the characters were pushed back. The file-position indicator
39 is decremented (by one or more) by each successful call to ungetwc();
40 if its value was 0 before a call, its value is indeterminate after the
41 call.
42
44 Upon successful completion, ungetwc() returns the wide-character code
45 corresponding to the pushed-back character. Otherwise it returns WEOF.
46
48 The ungetwc() function may fail if:
49
50 EILSEQ An invalid character sequence is detected, or a wide-charac‐
51 ter code does not correspond to a valid character.
52
53
55 See attributes(5) for descriptions of the following attributes:
56
57
58
59
60 ┌─────────────────────────────┬─────────────────────────────┐
61 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
62 ├─────────────────────────────┼─────────────────────────────┤
63 │Interface Stability │Standard │
64 ├─────────────────────────────┼─────────────────────────────┤
65 │MT-Level │MT-Safe │
66 └─────────────────────────────┴─────────────────────────────┘
67
69 read(2), fseek(3C), fsetpos(3C), rewind(3C), setbuf(3C), attributes(5),
70 standards(5)
71
72
73
74SunOS 5.11 14 Aug 2002 ungetwc(3C)