diff options
| author | thecharlesblake | 2017-11-14 01:50:18 +0000 |
|---|---|---|
| committer | thecharlesblake | 2017-11-14 01:50:18 +0000 |
| commit | fbc39b856dc7b10e4d5dacb90741ea85f22da8bc (patch) | |
| tree | e1d191e429de72f479646378ce3f4a7973629410 /src/main/util/util.cpp | |
| parent | Add new valid sol check to main (diff) | |
| download | metasol-fbc39b856dc7b10e4d5dacb90741ea85f22da8bc.tar.gz metasol-fbc39b856dc7b10e4d5dacb90741ea85f22da8bc.zip | |
Add util class, with read file to string method
Diffstat (limited to 'src/main/util/util.cpp')
| -rw-r--r-- | src/main/util/util.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/util/util.cpp b/src/main/util/util.cpp index ed46d3b..46038aa 100644 --- a/src/main/util/util.cpp +++ b/src/main/util/util.cpp @@ -2,4 +2,22 @@ // Created by thecharlesblake on 11/13/17. // +#include <fstream> +#include <sstream> + #include "util.h" + +using namespace std; +using namespace boost; + +const optional<string> util::read_file(const string& filename) { + ifstream ifstr(filename); + stringstream buf; + buf << ifstr.rdbuf(); + + if (ifstr.fail()) { + return none; + } else { + return buf.str(); + } +} |
