std::basic_istream<CharT,Traits>::peek (3) - Linux Man Pages
Behaves as UnformattedInputFunction. After constructing and testing the sentry object, reads the next character from the input stream without extracting it.
If good() == true, returns the next character as obtained by rdbuf()->sgetc()
Otherwise, returns Traits::eof().
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
sgetc (public member function of std::basic_streambuf<CharT,Traits>)
get (public member function)
unget (public member function)