17 lines
478 B
C++
17 lines
478 B
C++
#pragma once
|
|
|
|
#include <fstream>
|
|
|
|
class SystemHelper {
|
|
public:
|
|
static std::string read_file_to_string(const std::string &filePath) {
|
|
std::ifstream file(filePath);
|
|
if (!file.is_open()) {
|
|
throw std::runtime_error("Could not open file: " + filePath);
|
|
}
|
|
std::string content((std::istreambuf_iterator<char>(file)),
|
|
std::istreambuf_iterator<char>());
|
|
file.close();
|
|
return content;
|
|
}
|
|
}; |