#include "Util.h" #include #include #include "Exception.h" std::string Util::load_file(const std::string& path) { std::ifstream input_stream; try { input_stream.open(path); } catch (std::ios::failure& e) { throw Exception(std::string("Error Opening File: ") + e.what(), "class Util"); } if (input_stream.is_open()) { input_stream.seekg(0, std::ios::end); std::size_t size = input_stream.tellg(); std::string buffer(size, ' '); input_stream.seekg(std::ios::beg); input_stream.read(&buffer[0], size); return buffer; } else { throw Exception("Unable to access file: " + path, "class Util"); } }