0
ファイルを動的に作成しようとしていますが、fstreamでは方法がないようです。実際にはありますか?ファイルの動的作成をfstreamでサポートしていません
#include <iostream>
#include <fstream>
using namespace std;
int main() {
for (int i = 0; i<2; ++i){
std::ofstream outfile
outfile.open ((char)i+"sample_file.txt"); // something like this. numbers appended to the filename
outfile << i;
outfile.close();
}
}
'(char)i +" sample_file.txt "はあなたの考えをしていません。これはJava/C#ではなくC++です。 – heavyd