I'm working on a C++ code, but I'm having some problems since I have never used this language before.
The structure of my project (.pro) file contains different .ccp files, including:
IOFile.cpp
: where the file name I want to change is;
CModel.cpp
: where there is the model of my project and, particularly, the parameter (float), chosen by user each time, that I would like to use for my file name.
So, for now the output name is something like: filename.txt, but I would like to rename it in order to obtain in somthing like filename_parameter.txt (for example: file_0.998.txt).
The void of my IOFile.cpp
is written like:
void IOFile::saveIntensityMap(const char* fileName, vector<float>* intensityMap)
{
std::ofstream file(fileName, std::fstream::out|std::fstream::trunc);
}
whereas the parameter (ray_factor) is initialized in the CModel.cpp
file:
ray_factor= 0.99f
So, how could I pass the ray_factor, that is in CModel
, to the IOfile
? And how can I write a filename that includes a string and a float?
Sorry for the silly question, but I can't find a solution.