Standard C++ Library Reference ISO/IEC (VERSION3)

advances the next pointer for the input buffer.
It can read an element directly, from some external source, and deliver it as the value ch.
For a stream buffer with common input and output streams, it can make a read position
available by writing out, to some external destination, some or all of the elements
between the beginning and next pointers for the output buffer. Or it can allocate new or
additional storage for the input buffer. The function then reads in, from some external
source, one or more elements.
If the function cannot succeed, it returns traits_type::eof(), or throws an exception.
Otherwise, it returns the current element ch in the input stream, converted as described above,
and advances the next pointer for the input buffer. The default behavior is to call
underflow() and, if that function returns traits_type::eof(), to return
traits_type::eof(). Otherwise, the function returns the current element ch in the input
stream, converted as described above, and advances the next pointer for the input buffer.
basic_streambuf::underflow
virtual int_type underflow();
The protected virtual member function endeavors to extract the current element ch from the
input stream, without advancing the current stream position, and return it as
traits_type::to_int_type(ch). It can do so in various ways:
If a read position is available, ch is the element stored in the read position.
It can make a read position available by allocating new or additional storage for the input
buffer, then reading in, from some external source, one or more elements.
If the function cannot succeed, it returns traits_type::eof(), or throws an exception.
Otherwise, it returns the current element in the input stream, converted as described above. The
default behavior is to return traits_type::eof().
basic_streambuf::xsgetn
virtual streamsize xsgetn(char_type *ptr, streamsize count);
The protected virtual member function extracts up to count elements from the input stream, as
if by repeated calls to sbumpc, and stores them in the array beginning at ptr. It returns the
number of elements actually extracted.
basic_streambuf::xsputn
virtual streamsize xsputn(const char_type *ptr,
streamsize count);
The protected virtual member function inserts up to count elements into the output stream, as