#include <iostream> #include <fstream> using namespace std; int main() { ifstream fin("d:\\data\\english_story.txt"); if(fin.good()) { cout<<"打开文件成功,以下是文件内容"<<endl; char ch; while (!fin.eof())//未到文件尾时循环 { ch=fin.get(); cout<<ch; } } else cout<<"打开文件错误"<<endl; fin.close(); return 0; }