c++ 读入和写入文件

读入

#include<ifstream>

ifstream infile;
infile.open(img_dir);
while(getline(infile,tmp)){

}

写入

#include <fstream>

ofstream outfile;
outfile.open(txt_dir)
outfile<<123<<endl;
outfile.close();
原文地址:https://www.cnblogs.com/ymjyqsx/p/9077521.html