diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-08-24 00:25:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-24 00:25:31 +0100 |
commit | a326354ea6fccf76665a4212bf14daeba0f52ec8 (patch) | |
tree | 18cd2deb0c30b38d8ca7c5305735d2323259e020 /src/iomanager.cpp | |
parent | 0a49874288f92c120d7e165550eb6dbbe1ef7307 (diff) | |
parent | 5403490b941f7c031bf1aafdb91b1098f69edbf2 (diff) | |
download | YAGE-a326354ea6fccf76665a4212bf14daeba0f52ec8.tar.gz YAGE-a326354ea6fccf76665a4212bf14daeba0f52ec8.zip |
Merge pull request #3 from ymherklotz/developv0.1.0
Merge develop to master
Diffstat (limited to 'src/iomanager.cpp')
-rw-r--r-- | src/iomanager.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/iomanager.cpp b/src/iomanager.cpp index 6059bfbc..60cd7201 100644 --- a/src/iomanager.cpp +++ b/src/iomanager.cpp @@ -11,13 +11,16 @@ #include <fstream> #include <stdexcept> -namespace yage { +namespace yage +{ -bool IoManager::readFileToBuffer(const std::string& file_path, - std::vector<unsigned char>& buffer) { +bool IoManager::readFileToBuffer(const std::string &file_path, + std::vector<unsigned char> &buffer) +{ std::ifstream file(file_path, std::ios::binary); - if (!file.is_open()) + if (!file.is_open()) { throw std::runtime_error("Could not open '" + file_path + "'"); + } // seek to the end file.seekg(0, std::ios::end); @@ -30,10 +33,10 @@ bool IoManager::readFileToBuffer(const std::string& file_path, file_size -= file.tellg(); buffer.resize(file_size); - file.read((char*)&buffer[0], file_size); + file.read((char *)&buffer[0], file_size); file.close(); return true; } -} // yage +} // yage |