最简单的读文本文件
#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; }
本博客注有“转”字样的为转载文章,其余为本人原创文章,转载请务必注明出处或保存此段。c++/lua/windows逆向交流群:69148232