1UNGETWC(P)                 POSIX Programmer's Manual                UNGETWC(P)
2
3
4

NAME

6       ungetwc - push wide-character code back into the input stream
7

SYNOPSIS

9       #include <stdio.h>
10       #include <wchar.h>
11
12       wint_t ungetwc(wint_t wc, FILE *stream);
13
14

DESCRIPTION

16       The  ungetwc()  function  shall push the character corresponding to the
17       wide-character code specified by wc back onto the input stream  pointed
18       to  by  stream.  The pushed-back characters shall be returned by subse‐
19       quent reads on that stream in the reverse order  of  their  pushing.  A
20       successful intervening call (with the stream pointed to by stream) to a
21       file-positioning function ( fseek(), fsetpos(), or  rewind())  discards
22       any  pushed-back characters for the stream. The external storage corre‐
23       sponding to the stream is unchanged.
24
25       At least one character of push-back shall be provided. If ungetwc()  is
26       called too many times on the same stream without an intervening read or
27       file-positioning operation on that stream, the operation may fail.
28
29       If the value of wc equals that of the macro WEOF, the  operation  shall
30       fail and the input stream shall be left unchanged.
31
32       A  successful  call  to ungetwc() shall clear the end-of-file indicator
33       for the stream. The value of the file-position indicator for the stream
34       after  reading  or  discarding  all pushed-back characters shall be the
35       same as it was before the characters were pushed back.  The  file-posi‐
36       tion  indicator is decremented (by one or more) by each successful call
37       to ungetwc(); if its value was 0 before a call, its value  is  unspeci‐
38       fied after the call.
39

RETURN VALUE

41       Upon  successful  completion, ungetwc() shall return the wide-character
42       code corresponding to the pushed-back character.  Otherwise,  it  shall
43       return WEOF.
44

ERRORS

46       The ungetwc() function may fail if:
47
48       EILSEQ An  invalid  character sequence is detected, or a wide-character
49              code does not correspond to a valid character.
50
51
52       The following sections are informative.
53

EXAMPLES

55       None.
56

APPLICATION USAGE

58       None.
59

RATIONALE

61       None.
62

FUTURE DIRECTIONS

64       None.
65

SEE ALSO

67       fseek() , fsetpos() , read() , rewind() , setbuf() , the  Base  Defini‐
68       tions volume of IEEE Std 1003.1-2001, <stdio.h>, <wchar.h>
69
71       Portions  of  this text are reprinted and reproduced in electronic form
72       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
73       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
74       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
75       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
76       event of any discrepancy between this version and the original IEEE and
77       The  Open Group Standard, the original IEEE and The Open Group Standard
78       is the referee document. The original Standard can be  obtained  online
79       at http://www.opengroup.org/unix/online.html .
80
81
82
83IEEE/The Open Group                  2003                           UNGETWC(P)
Impressum