From 401d6085f34cce3b615267f44a5e1293f9eebcb0 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Thu, 12 Mar 2020 09:01:45 +0200
Subject: [PATCH] Ensure binary file mode

---
 components/streams/src/filestream.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/streams/src/filestream.cpp b/components/streams/src/filestream.cpp
index 75de7bdc3..9766298b1 100644
--- a/components/streams/src/filestream.cpp
+++ b/components/streams/src/filestream.cpp
@@ -270,7 +270,7 @@ bool File::_open() {
         istream_->seekg(0);
 	} else {
 		if (!istream_) istream_ = new std::ifstream;
-		istream_->open(*get<std::string>("filename"));
+		istream_->open(*get<std::string>("filename"), std::ifstream::in | std::ifstream::binary);
 
 		if (!istream_->good()) {
 			LOG(ERROR) << "Could not open file: " << *get<std::string>("filename");
@@ -314,7 +314,7 @@ bool File::begin(bool dorun) {
 		if (dorun) run();
 	} else if (mode_ == Mode::Write) {
 		if (!ostream_) ostream_ = new std::ofstream;
-		ostream_->open(*get<std::string>("filename"));
+		ostream_->open(*get<std::string>("filename"), std::ifstream::out | std::ifstream::binary);
 
 		if (!ostream_->good()) {
 			LOG(ERROR) << "Could not open file: " << *get<std::string>("filename");
-- 
GitLab