protected virtual member function
<fstream>
std::filebuf::pbackfail
int pbackfail (int c = EOF);
Put character back on backup underflow
Moves the current input position on position back to point to the previous character and, if supported, makes c available as that next character to be read.
If the implementation does not support writing to putback positions, c shall either match the character at the putback position or be the end-of-file value (EOF). Otherwise, the function fails.
If the get pointer (gptr) is at the beginning of the character sequence before the call, the function may either fail or make additional putback positions available and succeed, depending on the library implementation.
In no case the contents of the associated file are modified by the function.
On failure, the function returns the end-of-file value (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.
This member function overrides the inherited virtual member streambuf::pbackfail.
Parameters
- c
- Character to be put back, or the end-of-file value (EOF) to keep the value of the character at the putback position.
Data races
Modifies the filebuf object.
Concurrent access to the same file stream buffer object may introduce data races.
Exception safety
Basic guarantee: if an exception is thrown, the file stream buffer is in a valid state.
See also
- filebuf::underflow
- Get character on underflow (protected virtual member function
)
- streambuf::pbackfail
- Put character back in the case of backup underflow (protected virtual member function
)