streambuf::in_avail
streamsize in_avail ( );
streambuf
  cplusplus.com  

Get number of characters available in input buffer.
  The number of characters available between the location pointed by get pointer and the end of the input buffer.
  The function calculates this by subtracting the value returned by protected member gptr from value returned by protected member egptr if a read position is available, otherwise it uses the value returned by protected member showmanyc.

Parameters.

none
 

Return Value.
  The number of characters available in the input buffer.
  This is a value of type streamsie.

Example.

// in_avail () example
#include <iostream>
using namespace std;

int main () {

  streamsize size;
  char ch;

  streambuf * pbuf;
  pbuf = cin.rdbuf();

  cout << "Please enter some characters: ";
  cin >> ch;

  size = pbuf->in_avail();

  cout << "The first character you entered is: " << ch << endl;
  cout << size << " additional characters in input buffer" << endl;

  return 0;
}

Basic template member declaration ( basic_streambuf<charT,traits> ):
streamsize in_avail ( );

See also.
  streambuf class


© The C++ Resources Network, 2001