As mentioned, characters can be put back into the read buffer by using the functions
sputbackc() and sungetc(). sputbackc() gets the character to be put back as its argument and
ensures that this character was indeed the character read. Both functions decrement the read pointer,
if possible. Of course, this works only as long as the read pointer is not at the beginning of the read
buffer. If you attempt to put a character back after the beginning of the buffer is reached, the virtual
function pbackfail() is called. By overriding this function, you can implement a mechanism to restore
the old read position even in this case. In the base class basic_streambuf, no corresponding
behavior is defined. Thus, in practice, it is not possible to go back an arbitrary number of characters.
For streams that do not use a buffer, the function pbackfail() should be implemented because it
is generally assumed that at least one character can be put back into the stream.