#include <fstream>
#include <iostream>
using namespace std;
int main(){
int value=0;
for (int i=0;i<4;i++)
{
ofstream myfile("Etc/filename");
string filename ="key" + i +".txt";
myfile<<value<<endl;
}
myfile.close();
}
如何将文件保存在具有key1.txt,key2.txt,key3.txt,key4.txt的etc文件夹下? 似乎我有一个问题,ofstream myfile ...将文件名保存到特定文件夹中
任何人都可以启发我如何改变它呢?谢谢!
'串filename'从未使用过... – parrowdice
@parrowdice它似乎是一个问题,ofstream的MYFILE(“文件夹/ “+文件名); – user3292128