From: Paulo Custodio Date: Sat, 5 Nov 2016 13:00:08 +0000 (+0000) Subject: Open text files with "wb" causes issues on Windows X-Git-Tag: 1.0~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=042696f7e8c9569afbe130760d85074a69a84087;p=re2c Open text files with "wb" causes issues on Windows Text files need to be opened for writing with "w", so that stdio does the right thing in respect to the correct line endings for the current OS. ("\r\n" in Windows, "\n" in Linux). --- diff --git a/re2c/src/codegen/output.cc b/re2c/src/codegen/output.cc index 5276ef77..8d4f3945 100644 --- a/re2c/src/codegen/output.cc +++ b/re2c/src/codegen/output.cc @@ -71,7 +71,7 @@ bool OutputFile::open () } else { - file = fopen (file_name, "wb"); + file = fopen (file_name, "w"); } return file != NULL; } @@ -346,7 +346,7 @@ HeaderFile::HeaderFile (const char * fn) bool HeaderFile::open () { - file = fopen (file_name, "wb"); + file = fopen (file_name, "w"); return file != NULL; }