I have some C++ code developed by a former employee. I'm trying to clarify/test some of the software results. In an intermediate step, the software saves a 'binary' dat file with results, which is later imported by another part of the software.
My aim is to change this output from 'binary' to human readable numbers.
The output file is defined:
ofstream pricingOutputFile;
double *outputMatrix[MarketCurves::maxAreaNr];
ofstream outputFile[MarketCurves::maxAreaNr];
The write step is this one:
pricingOutputFile.write((char *)&outputMatrix[area], sizeof(double));
The matrix is filled with 'doubles'
Is there a way to change this to output a human readable file?
I have tried various std::string
cout
and other methods 'googled' but until now without success.
Tried the suggestion with << but that gave the following error: error C2297: '<<' : illegal, right operand has type 'double'
The sugestions her pushed me on the right track:
sprintf_s(buffer, 10, "%-8.2f", rowPos);
pricingOutputFile.write((char *)&buffer, 10);
Inspiration found at: http://www.tenouk.com/cpluscodesnippet/usingsprintf_s.html
Thanks for the help