std::basic_streambuf<CharT,Traits>::sungetc (3) - Linux Man Pages
If a putback position is available in the get area (gptr() > eback()), then decrements the next pointer (gptr()) and returns the character it now points to.
If a putback position is not available, then calls pbackfail() to back up the input sequence if possible.
The I/O stream function basic_istream::unget is implemented in terms of this function.
If putback position was available, returns the character that the next pointer is now pointing at, converted to int_type with Traits::to_int_type(*gptr()). The next single-character input from this streambuf will return this character.
If putback position was not available, returns what pbackfail() returns, which is Traits::eof() on failure.
// Run this code
sputbackc (public member function)
unget (public member function of std::basic_istream<CharT,Traits>)