Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ungetwc - push wide character back onto input stream

&pagelevel(4)&pagelevel

Syntax

#include <wchar.h>

Optional
#include <stdio.h> (End)

wint_t ungetwc(wint_t wc, FILE *stream);

Description ungetwc() pushes the character corresponding to the wide character code wc back onto

the input stream pointed to by stream. The pushed-back characters will be returned by
subsequent reads on that stream in reverse order. A successful intervening call to a
filepositioning function (fseek(), fsetpos() or rewind()) for the same data stream deletes
the pushed-back characters for the stream. The external storage associated with the data
stream remains unchanged.

One byte of pushback is guaranteed. If ungetwc() is called too many times on the same
stream without an intervening read or file-positioning operation on that stream, the
pushback operation may fail.

If the value of wc is equal to the macro WEOF, the operation will fail and the input stream will
remain unchanged.

A successful call to ungetwc() clears the end-of-file indicator for the stream. The value of
the file-position indicator for the stream after reading or discarding all pushed-back bytes
will be the same as it was before the bytes were pushed back. The file-position indicator is
decremented by each successful call to ungetwc(); if its value was 0 before a call, its value
will be indeterminate after the call.

Restriction
This version of the C runtime system only supports 1-byte characters as wide character
codes. They are of type wchar_t (see stddef.h). (End)

Return val.

Pushed back wide character

upon successful completion.

WEOF

if the wide character could not be pushed back. errno is set to indicate the
error.

Errors

ungetwc() will fail if:

Extension
EINVAL     An attempt was made to access a BS2000 file.

See also

fseek(), fsetpos(), read(), rewind(), setbuf(), stdio.h, wchar.h.