virtual int underflow() = 0;
The virtual underflow function, together with the sync and overflow functions, defines the characteristics of the streambuf-derived class. Each derived class might implement underflow differently, but the interface with the calling stream class is the same.
The underflow function is most frequently called by public streambuf functions like sgetc and sgetn when they sense that the get area is empty, but other classes, including the stream classes, can call underflow anytime.
The underflow function supplies the get area with characters from the input source. If the get area contains characters, then underflow returns the first character. If the get area is empty, then it fills the get area and returns the next character (which it leaves in the get area). If there are no more characters available, then underflow returns EOF and leaves the get area empty.
In the strstreambuf class, underflow adjusts the egptr pointer to access storage that was dynamically allocated by a call to overflow.
No default implementation. Derived classes must define this function.