Hi,
I am rather inexperienced C++ programmer, so this question is probably rather basic. I am trying to get the file name for my copula:
string MonteCarloBasketDistribution::fileName(char c)
{
char result[100];
sprintf(result, "%c_%s(%s, %s).csv", copula.toString().c_str(), left.toString().c_str(), right.toString().c_str());
return string(result);
}
which is used in:
MonteCarloBasketDistribution::MonteCarloBasketDistribution(Copula &c, Distribution &l, Distribution &r): copula(c), left(l), right(r)
{
//.....
ofstream funit;
funit.open (fileName('u').c_str());
ofstream freal;
freal.open (fileName('r').c_str());
}
However, the files created have rubbish names, consisting mainly from weird characters. Any idea what I am doing wrong and how to fix it?