I did try a stringstream, to no avail. If anyone has a simple example of something that could work for me, that would be much appreciated.
Basically, I need to convert a double or int into a string and concatenate it so that it is usable in myfile.open
well you are using
char filename , it should be
char * filename = new char[50];
do not furgate to delete above memory after use.
1 2 3 4 5 6 7
|
clock_t currT = clock() * CLK_TCK;
std::ostringstream oss; // string as stream
oss << "C:\\Folder\\output_" << currT << ".txt"; // write to string stream
std::string file_name = oss.str(); // get string out of stream
myfile.open(file_name.c_str()); // use c_str() to optain a const char* required for open() function.
|
Last edited on