I/O manipulators | ||||
Print functions(C++23) | ||||
C-style I/O | ||||
Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
Streams | ||||
Abstractions | ||||
File I/O | ||||
String I/O | ||||
Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
Synchronized Output | ||||
(C++20) | ||||
Types | ||||
Error category interface | ||||
(C++11) | ||||
(C++11) |
Types and objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Defined in header <cwchar> | ||
std::wint_t ungetwc(std::wint_t ch,std::FILE* stream); | ||
Ifch
does not equalWEOF, pushes the wide characterch
into the input buffer associated with the streamstream
in such a manner than subsequent read operation fromstream
will retrieve that wide character. The external device associated with the stream is not modified.
Stream repositioning operationsstd::fseek,std::fsetpos, andstd::rewind discard the effects ofstd::ungetwc
.
Ifstd::ungetwc
is called more than once without an intervening read or repositioning, it may fail (in other words, a pushback buffer of size 1 is guaranteed, but any larger buffer is implementation-defined). If multiple successfulstd::ungetwc
were performed, read operations retrieve the pushed-back wide characters in reverse order ofstd::ungetwc
Ifch
equalsWEOF, the operation fails and the stream is not affected.
A successful call tostd::ungetwc
clears the end of file status flagfeof.
A successful call tostd::ungetwc
on a stream (whether text or binary) modifies the stream position indicator in unspecified manner but guarantees that after all pushed-back wide characters are retrieved with a read operation, the stream position indicator is equal to its value beforestd::ungetwc
.
ch | - | wide character to be put back |
stream | - | file stream to put the wide character back to |
On successch
is returned.
On failureWEOF is returned and the given stream remains unchanged.
puts a character back into a file stream (function)[edit] | |
gets a wide character from a file stream (function)[edit] | |
C documentation forungetwc |