If no other solutions, you can try this. If you need your log file in Unicode format, then you can open the file in binary mode:
Log_File.Open(..., CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
In this file strings are not truncated, but you have to put "\r\n" at the end of each strings.
If you need the file in Ansi format, then open the file in text mode:
Log_File.Open(..., CFile::modeCreate | CFile::modeWrite | CFile::typeText);
Then instead of WriteString, convert your Unicode string to Ansi format and write using Write. For simple conversion, you can try _bstr_t:
_bstr_t s = update_string;
const char * ptr = s;
Log_File.Write(ptr, lstrlenA(ptr));
This works well in our tests.
Use this way unless a better method is found.
|