protected virtual member function
<fstream>
std::filebuf::underflow
Get character on underflow
Returns the character at the current input position, without advancing the input position pointer.
Before that, this function attempts to read characters from the associated file and -if the object keeps an intermediate buffer- makes them available by altering the internal input buffer pointers (gptr, egptr and eback) as needed.
If there are no more characters available and the function did not succeed in reading more characters from the associated file, it returns the end-of-file value (EOF), indicating failure.
This virtual member function overrides the inherited member streambuf::underflow, called by members such as sgetc to request a new character when there are no read positions available at the get pointer (gptr).
The behavior of this member function is similar to that of uflow, except that the input position is not advanced.
Return Value
The character at the current position of the controlled input sequence, converted to a value of type int
.
If there are no more characters to read from the controlled input sequence, it returns the end-of-file value (EOF).
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::uflow
- Get character on overflow and advance position (protected virtual member function
)
- streambuf::underflow
- Get character on underflow (protected virtual member function
)
- streambuf::sgetc
- Get current character (public member function
)