diff options
author | Oleg Morozenkov <m@oleg.rocks> | 2018-07-23 02:35:50 +0300 |
---|---|---|
committer | Oleg Morozenkov <m@oleg.rocks> | 2018-07-23 02:35:50 +0300 |
commit | 98b8b7e4338b71ee46c4301b0bf2ae667be9a99d (patch) | |
tree | 32f8b0d32048b2d83b57773c0efa3db9600b8701 /src/tools/FileTools.cpp | |
parent | 1dd3affe306793d2129f121c11e43c45ae8690da (diff) | |
parent | 167e3e7607e43a0f06c7f87ced94f481e6525b0e (diff) |
Merge branch 'master' into nicholascw-master
Diffstat (limited to 'src/tools/FileTools.cpp')
-rw-r--r-- | src/tools/FileTools.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/tools/FileTools.cpp b/src/tools/FileTools.cpp index 105d80f..279f152 100644 --- a/src/tools/FileTools.cpp +++ b/src/tools/FileTools.cpp @@ -12,24 +12,24 @@ using namespace std; namespace FileTools { string read(const string& filePath) { - ifstream in(filePath, ios::in | ios::binary); - if (!in) { - throw system_error(errno, system_category()); - } - ostringstream contents; - contents << in.rdbuf(); - in.close(); - return contents.str(); + ifstream in(filePath, ios::in | ios::binary); + if (!in) { + throw system_error(errno, system_category()); + } + ostringstream contents; + contents << in.rdbuf(); + in.close(); + return contents.str(); } bool write(const string& content, const string& filePath) { - ofstream out(filePath, ios::out | ios::binary); - if (!out) { - return false; - } - out << content; - out.close(); - return true; + ofstream out(filePath, ios::out | ios::binary); + if (!out) { + return false; + } + out << content; + out.close(); + return true; } }; |