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

PROLOG

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

NAME

12       ungetwc — push wide-character code back into the input stream
13

SYNOPSIS

15       #include <stdio.h>
16       #include <wchar.h>
17
18       wint_t ungetwc(wint_t wc, FILE *stream);
19

DESCRIPTION

21       The functionality described on this reference page is aligned with  the
22       ISO C  standard.  Any  conflict between the requirements described here
23       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
24       defers to the ISO C standard.
25
26       The  ungetwc()  function  shall push the character corresponding to the
27       wide-character code specified by wc back onto the input stream  pointed
28       to  by  stream.  The pushed-back characters shall be returned by subse‐
29       quent reads on that stream in the reverse order  of  their  pushing.  A
30       successful intervening call (with the stream pointed to by stream) to a
31       file-positioning function (fseek(), fseeko(), fsetpos(),  or  rewind())
32       or  fflush()  shall  discard any pushed-back characters for the stream.
33       The external storage corresponding to the stream is unchanged.
34
35       At least one character of push-back shall be provided. If ungetwc()  is
36       called too many times on the same stream without an intervening read or
37       file-positioning operation on that stream, the operation may fail.
38
39       If the value of wc equals that of the macro WEOF, the  operation  shall
40       fail and the input stream shall be left unchanged.
41
42       A  successful  call  to ungetwc() shall clear the end-of-file indicator
43       for the stream. The value of the file-position indicator for the stream
44       after  all pushed-back characters have been read, or discarded by call‐
45       ing fseek(), fseeko(), fsetpos(), or rewind() (but not fflush()), shall
46       be the same as it was before the characters were pushed back. The file-
47       position indicator is decremented (by one or more) by  each  successful
48       call  to  ungetwc();  if  its  value  was 0 before a call, its value is
49       unspecified after the call.
50

RETURN VALUE

52       Upon successful completion, ungetwc() shall return  the  wide-character
53       code  corresponding  to  the pushed-back character. Otherwise, it shall
54       return WEOF.
55

ERRORS

57       The ungetwc() function may fail if:
58
59       EILSEQ An invalid character sequence is detected, or  a  wide-character
60              code does not correspond to a valid character.
61
62       The following sections are informative.
63

EXAMPLES

65       None.
66

APPLICATION USAGE

68       None.
69

RATIONALE

71       None.
72

FUTURE DIRECTIONS

74       None.
75

SEE ALSO

77       Section   2.5,   Standard  I/O  Streams,  fseek(),  fsetpos(),  read(),
78       rewind(), setbuf()
79
80       The Base Definitions volume of POSIX.1‐2017, <stdio.h>, <wchar.h>
81
83       Portions of this text are reprinted and reproduced in  electronic  form
84       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
85       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
86       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
87       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
88       event of any discrepancy between this version and the original IEEE and
89       The Open Group Standard, the original IEEE and The Open Group  Standard
90       is  the  referee document. The original Standard can be obtained online
91       at http://www.opengroup.org/unix/online.html .
92
93       Any typographical or formatting errors that appear  in  this  page  are
94       most likely to have been introduced during the conversion of the source
95       files to man page format. To report such errors,  see  https://www.ker
96       nel.org/doc/man-pages/reporting_bugs.html .
97
98
99
100IEEE/The Open Group                  2017                          UNGETWC(3P)
Impressum