返回在最后一个非格式化输入期间读取的字符数。
streamsize gcount( ) const;
返回值
提取计数。
备注
使用 basic_istream::get 读取非格式化字符。
示例
// 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 键入字母“a:一个1
要求
标头: <istream>
命名空间: std