Hola Carlos
Try this:
File logFile;
logFile.OpenOrCreate( outputFilePath );
logFile.OutTextLn( "PreCalcium Log File" );
logFile.OutTextLn( "" );
logFile.OutTextLn( "" );
logFile.OutTextLn( "_maximum Auxiliary File - Scale Factors" );
logFile.OutTextLn( IsoString().Format( "[0] Maximum value : %u", scale[0] ) );
logFile.OutTextLn( IsoString().Format( "[1] Time scale : %u", scale[1] ) );
logFile.OutTextLn( IsoString().Format( "[2] Average value : %u", scale[2] ) );
logFile.OutTextLn( IsoString().Format( "[3] Standard deviation value : %u", scale[3] ) );
logFile.OutTextLn( "Total Calcium at each frame:" );
for (int k = 0; k < mean.Length(); ++k)
logFile.OutTextLn( IsoString().Format( "%u - %u", k, mean[k] ) );
logFile.Close();
The File::OutText() family of functions allow you to write plain text just as you want. OutTextLn() appends a newline (UNIX convention by default) to the text written, so you don't have to bother with \n escape sequences.
On the other hand, you should use IsoString instead of String. What you want to write is a text file encoded as UTF-8 or ISO-8859-1 (=IsoString), not as UTF-16 (=String), or you'll have problems. Since your text does not include non-ASCII characters, you don't have to bother with UTF-16 -> UTF-8 conversions; otherwise you should generate a String and then write it converted to UTF-8 (String::ToUTF8()).
Finally, if what you want to do is creating/overwriting a log file each time you run your code, then consider File::CreateForWriting() instead of File::OpenOrCreate(). The latter will open an existing file in case you want to append more text, but I doubt this is what you want to do.
Hope this helps!