basic_streambuf::in_avail

streamsize in_avail();

If a read position is available, the member function returns egptr() - gptr(). Otherwise, it returns showmanyc().