protected virtual member function
<streambuf> <iostream>

std::streambuf::underflow

int underflow();
Get character on underflow
Virtual function called by other member functions to get the current character in the controlled input sequence without changing the current position.

It is called by public member functions such as sgetc to request a new character when there are no read positions available at the get pointer (gptr).

Its default behavior in streambuf is to return the character pointed by gptr (without advancing it), if characters are available at that position. Or, if there are no characters, the function always returns EOF (indicating failure), but derived classes can override this behavior to modify the gptr and egptr internal pointers in such a way that more characters from the input sequence may be made accessible through the buffer (if these are available). Both filebuf and stringbuf override this virtual member function.

Parameters

none

Return Value

The character at the current position of the controlled input sequence, as a value of type int.
If there are no more characters to read from the controlled input sequence, the function returns the end-of-file value (EOF).

Data races

Modifies the stream buffer object.
Concurrent access to the same stream buffer object may introduce data races.

Exception safety

Basic guarantee: if an exception is thrown, the stream buffer is in a valid state.

See also