Carlos Milovic
Well-known member
Hi guys
I need a hand here I'm trying to create a new text file, containing the same output as I throw to the console, to work as a log file for the data extraction I'm doing with the images.
So far, I wrote that kind of works:
The file is created fine, and the output text seems to be writed fine, but there are lots of weird characters (file attached). Am I doing something wrong? I tried to use previously ofstream, but it refused to work within my code.
I need a hand here I'm trying to create a new text file, containing the same output as I throw to the console, to work as a log file for the data extraction I'm doing with the images.
So far, I wrote that kind of works:
Code:
File logFile;
logFile.OpenOrCreate( outputFilePath );
logFile.Write( "PreCalcium Log File\n\n\n" );
logFile.Write( "_maximum Auxiliary File - Scale Factors\n");
logFile.Write( String().Format( "[0] Maximum value : %u \n", scale[0] ) );
logFile.Write( String().Format( "[1] Time scale : %u \n", scale[1] ) );
logFile.Write( String().Format( "[2] Average value : %u \n", scale[2] ) );
logFile.Write( String().Format( "[3] Standard deviation value : %u \n", scale[3] ) );
logFile.Write( "Total Calcium at each frame:\n" );
for (int k = 0; k < mean.Length(); ++k)
logFile.Write( String().Format( "%u - %u", k,mean[k]) );
logFile.Close();
The file is created fine, and the output text seems to be writed fine, but there are lots of weird characters (file attached). Am I doing something wrong? I tried to use previously ofstream, but it refused to work within my code.