#include #include #include "readfile.h" #include "utils.h" #include "../output.h" using namespace std; using namespace debug; using namespace error; namespace utils { string readfile(const char* filename) { ifstream file(filename); if (!checkfile(file)) { exit(EXIT_FAILURE); } string data, line; while (getline(file, line)) { data += line; data += '\n'; } data.pop_back(); file.close(); return data; } bool checkfile(ifstream& file) { if (!file.is_open()) { throwError(FILE_NOT_FOUND, "File not found", __LINE__, __FILE__); return false; } return true; } }