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

Definition   

#include <stdio.h>
#include <wchar.h>

wint_t ungetwc(wint_t c, FILE *fp);

ungetwc pushes the wide character c back to the buffer assigned to the file described by file pointer fp. The next read operation that reads one character at a time from this file (getwc) will then return c once again.

One byte of pushback is guaranteed. This applies even if ungetwc directly follows a call for the formatted input of wide characters (fwscanf or wscanf). If ungetwc is called too many times on the same file without an intervening read or file-positioning operation on that file, the pushback operation may fail.

If the value of c is equal to the macro WEOF, the operation will fail, and WEOF is returned.

Return val.

Pushed back wide character


if successful.                                                 

WEOF

if the function fails.

Notes

This version of the C runtime system only supports one-byte characters as wide character codes.

WEOF cannot be pushed back.

After a successful ungetwc call, the read/write pointer is moved back one character.

A call to one of the following functions cancels the effects of the ungetwc call (e.g. backward positioning): fseek/fseek64, fsetpos/fsetpos64, lseek/lseek64, rewind, fflush.

If a character other than the one read previously is returned to the buffer, the original data is not changed when the buffer contents are written to the external file, i.e. the original data prior to the ungetc call is always written into the external file.

See also

getc, getwc, ungetc, ungetwc