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
Type the letter 'a':
a
1

Requirements

Header: <istream>

Namespace: std

See Also

Concepts

basic_istream Class

basic_istream Members

iostream Programming

iostreams Conventions