protected virtual member function
<sstream>

std::stringbuf::pbackfail

int pbackfail (int c = EOF);
Put character back
Moves back the get pointer(gptr) one position to point to the previous character, and if the stringbuf object was constructed with ios_base::out, it stores c at that position.

If the stringbuf object was not constructed with ios_base::out, c shall either match the character at the putback position or EOF. Otherwise, the function fails.

If the get pointer is already at the beginning of the character sequence before the call, the function also fails.

On failure, the function returns EOF without altering the get pointer (gptr).

This virtual function is called by public member functions of streambuf such as sungetc and sputbackc when there are no putback positions available at the get pointer (gptr), or when the character being put back does not match the one in the buffer.

Parameters

c
Character to be put back, or EOF to keep the value of the character at the putback position.

Return Value

On success, traits_type::not_eof(c).
The function returns EOF on failure.

Data races

Modifies the stringbuf object.
Concurrent access to the same object may cause data races.

Exception safety

Basic guarantee: if an exception is thrown, the object is in a valid state.

See also