Returns: An estimate of the number of
characters available in the sequence, or −1.
If it returns
a positive value, then successive calls to
underflow()
will not return
traits::eof()
until at least that number of characters have been
extracted from the stream.
If
showmanyc()
returns −1, then calls to
underflow()
or
uflow()
will fail.271
The
result character
is
the first character of the pending sequence if it is non-empty,
otherwise
the next character that would be read from the input sequence.
Effects: The function sets up the
gptr()
and
egptr()
such that
if the pending sequence is non-empty, then
egptr()
is non-null and
the characters in [gptr(), egptr()) are
the characters in the pending sequence,
otherwise
either gptr()
is null or
gptr()== egptr().
the backup sequence contains at least
gptr()- eback()
characters, in which case the characters in
[eback(), gptr())
agree with the last
gptr()- eback()
characters of the backup sequence, or
Preconditions: The constraints are the same as for
underflow(),
except that the result character is transferred from the pending
sequence to the backup sequence, and the pending sequence is not empty before the transfer.
Classes derived from
basic_streambuf
can provide more efficient ways to implement
xsgetn()
and
xsputn()
by overriding these definitions from the base class.