diff options
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 |