最简单的读文本文件
#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

浙公网安备 33010602011771号