读取文件尾标记
//>>和get()都可以读取文件尾标记
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin;
int index=0;
char temp;
fin.open("ss.txt");
if(fin.fail())
{
cout<<"Input file opening failed!"<<endl;
}
fin>>temp;
while(!fin.eof())
{
index++;
fin>>temp; //或换成fin.get(temp);
}
cout<<index<<endl;
cin>>temp;
return 0;
}