Fixed extra endline in file logging (windows)

This commit is contained in:
matlabbe
2026-07-04 11:37:03 -07:00
parent 6e6c67dda1
commit c0a4eb561d
+5 -2
View File
@@ -139,10 +139,13 @@ protected:
fileToClear.close(); fileToClear.close();
} }
// Open in binary mode: the log formatter already emits "\r\n" line endings explicitly.
// On Windows, text mode ("a") would translate the "\n" of that "\r\n" into "\r\n" again,
// producing "\r\r\n" on disk - i.e. an extra blank line between entries.
#ifdef _MSC_VER #ifdef _MSC_VER
fopen_s(&fout_, fileName_.c_str(), "a"); fopen_s(&fout_, fileName_.c_str(), "ab");
#else #else
fout_ = fopen(fileName_.c_str(), "a"); fout_ = fopen(fileName_.c_str(), "ab");
#endif #endif
if(!fout_) { if(!fout_) {