From 237381a251926612e1b9506bbf18df121d90dd39 Mon Sep 17 00:00:00 2001 From: "U-olece-PC\\olece" Date: Thu, 27 Aug 2015 10:19:07 +0200 Subject: [PATCH] Added std::ofstream::binary to all file reads and writes. --- src/sourcefile.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sourcefile.cc b/src/sourcefile.cc index 6039136..7fc796b 100644 --- a/src/sourcefile.cc +++ b/src/sourcefile.cc @@ -7,7 +7,7 @@ const size_t buffer_size=131072; //Only use on small files std::string juci::filesystem::read(const std::string &path) { std::stringstream ss; - std::ifstream input(path); + std::ifstream input(path, std::ofstream::binary); if(input) { ss << input.rdbuf(); input.close(); @@ -16,7 +16,7 @@ std::string juci::filesystem::read(const std::string &path) { } bool juci::filesystem::read(const std::string &path, Glib::RefPtr text_buffer) { - std::ifstream input(path); + std::ifstream input(path, std::ofstream::binary); if(input) { std::vector buffer(buffer_size); size_t read_length; @@ -38,7 +38,7 @@ bool juci::filesystem::read(const std::string &path, Glib::RefPtr juci::filesystem::read_lines(const std::string &path) { std::vector res; - std::ifstream input(path); + std::ifstream input(path, std::ofstream::binary); if (input) { do { res.emplace_back(); } while(getline(input, res.back())); } @@ -48,7 +48,7 @@ std::vector juci::filesystem::read_lines(const std::string &path) { //Only use on small files bool juci::filesystem::write(const std::string &path, const std::string &new_content) { - std::ofstream output(path); + std::ofstream output(path, std::ofstream::binary); if(output) output << new_content; else