diff --git a/wrap/FileWriter.cpp b/wrap/FileWriter.cpp index 38abf2488..03339a7f0 100644 --- a/wrap/FileWriter.cpp +++ b/wrap/FileWriter.cpp @@ -35,7 +35,7 @@ void FileWriter::emit(bool add_header, bool force_overwrite) const { // Only write a file if it is new, an update, or overwrite is forced string new_contents = oss.str(); if (force_overwrite || !file_exists || existing_contents != new_contents) { - ofstream ofs(filename_.c_str()); + ofstream ofs(filename_.c_str(), ios::binary); // Binary to use LF line endings instead of CRLF if (!ofs) throw CantOpenFile(filename_); // header diff --git a/wrap/utilities.cpp b/wrap/utilities.cpp index 9c5d93c76..6eb47c55d 100644 --- a/wrap/utilities.cpp +++ b/wrap/utilities.cpp @@ -29,7 +29,7 @@ using namespace std; /* ************************************************************************* */ string file_contents(const string& filename, bool skipheader) { - ifstream ifs(filename.c_str()); + ifstream ifs(filename.c_str(), ios::binary); // Do not do LF/CRLF translation - we always write in binary mode too if(!ifs) throw CantOpenFile(filename); // read file into stringstream