#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
int main()
{
ifstream inStream;
ofstream outStream;
stringstream ss;
outStream.open("outfile.txt");
for (int i = 1; i <= 100; ++i)
{
ss.str("");
ss.clear();
ss << i << ".jpg";
outStream << ss.str() << endl;
}
outStream.close();
inStream.open("outfile.txt");
string filename;
while (inStream >> filename)
{
ss.str("");
ss.clear();
ss << filename;
cout << ss.str() << endl;
}
inStream.close();
return 0;
}
C++写入和读取txt文件
最新推荐文章于 2024-05-18 10:02:23 发布