std::basic_istream<CharT,Traits>::unget (3) - Linux Man Pages
Makes the most recently extracted character available again.
First clears eofbit. (since C++11)
Then the function behaves as UnformattedInputFunction. After constructing and checking the sentry object, if any ios_base::iostate flags are set, the function sets failbit and returns. Otherwise, calls rdbuf()->sungetc().
If rdbuf()->sungetc() returns Traits::eof(), calls setstate(badbit).
In any case, sets the gcount() counter to zero.
failure if an error occurred (the error state flag is not goodbit) and exceptions() is set to throw for that state.
If an internal operation throws an exception, it is caught and badbit is set. If exceptions() is set for badbit, the exception is rethrown.
// Run this code
sungetc (public member function of std::basic_streambuf<CharT,Traits>)
get (public member function)
peek (public member function)
putback (public member function)