<span style="font-size:18px;">#include<iostream>
#include<fstream>
#include<iostream>
#include<string>
using namespace std;
int main(){
// 定义输入文件流类对象infile
string filename = "E:data1.txt";
//ofstream outFile(filename.c_str(), ios::app); //在文件末尾写入
//for (int r = 0; r<800; r++)
//{
// outFile << "E:/图像/第" << r << "个图像.jpg" << endl;
//}
ifstream file("E:data1.txt");
char data[100];
while (!file.eof())
{
file.getline(data, 100);
cout << data << endl;
}
file.close();
system("pause");
return 1;
}</span>
c++在txt中每行写入数据和每行输出
最新推荐文章于 2024-05-18 10:02:23 发布