Some fragments of code for customizing the file name and saving directory.
Customizing the file name with index:
//Output the customized files into specified folder
char directory[15] = "cells";
char fp[20];
int cell_id = 1;
//Specify the file name with index: "cell_id" in this case
int n = std::sprintf(fp, ".\\%s\\cell%d.obj", directory, cell_id);
FILE *fn = fopen(fp, "w");
//necessary operations for writing data into output file
fclose(fn);
Another way is to use stringstream to cumtomize string variable:
sample code
#include <iostream>
using namespace std;
#include <sstream>
#include <string>
int main()
{
stringstream outstream;
int i;
i = 1;
outstream << "subclass_" << i << ".obj";
string filename = outstream.str();
cout << filename << endl;
return 0;
}