(c)2015,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:test.cpp
*作 者:李文贺
*完成日期:2015年6月17日
*版 本 号:v1.0
*问题描述:
*输入描述:
*程序输出:结果
#include <iostream>
#include <cstdlib>
#include <fstream>
using namespace std;
int main()
{
fstream file;
file.open("abc.txt",ios::in);
if(!file)
{
cout<<"abc.txt can't open. "<<endl;
exit;
}
char ch;
int i=0;
while( !file.eof() )
{
file.get(ch);
++i;
}
cout<<"character:"<<i<<endl;
file.close();
return 0;
}