basic_streambuf::in_avail

Returns the number of elements that are ready to be read from the buffer.

streamsize in_avail( );

Return Value

The number of elements that are ready to be read from the buffer.

Remarks

If a read position is available, the member function returns egptrgptr. Otherwise, it returns showmanyc.

Example

// basic_streambuf_in_avail.cpp
// compile with: /EHsc
#include <iostream>

int main( ) 
{
   using namespace std;
   char c;
   // cin's buffer is empty, in_avail will return 0
   cout << cin.rdbuf( )->in_avail( ) << endl;
   cin >> c;
   cout << cin.rdbuf( )->in_avail( ) << endl;
}

Input

4

Sample Output

0
4
1

Requirements

Header: <streambuf>

Namespace: std

See Also

Reference

basic_streambuf Class

iostream Programming

iostreams Conventions

Other Resources

basic_streambuf Members