I'm trying to write a program which will create/output multiple files in a folder within a loop, but gives me errors. Is something like this possible to do? Been searching with no luck. Thanks! Here's an example:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream text;
for(int i = 0; i < 100; i++);
{
text.open("folder/" + i + ".txt");
text << "This is text file #" << i << "."<< endl;
text.close();
}
return 0;
}
std::string file_path = std::string("folder/") + std::to_string(i) + ".txt"-std=c++11flag.