basic_istream::gcount

Returns the number of characters read during the last unformatted input.

streamsize gcount( ) const;

Return Value

The extraction count.

Remarks

Use basic_istream::get to read unformatted characters.

Example

// basic_istream_gcount.cpp
// compile with: /EHsc
#include <iostream>
using namespace std;

int main( ) 
{
   cout << "Type the letter 'a': ";

   ws( cin );
   char c[10];

   cin.get( &c[0],9 );
   cout << c << endl;

   cout << cin.gcount( ) << endl;
}
  a
  a
Type the letter 'a':
a
1

Requirements

Header: <istream>

Namespace: std

See Also

Reference

basic_istream Class

iostream Programming

iostreams Conventions