14 lines
336 B
C++
14 lines
336 B
C++
#include "io.hpp"
|
|
|
|
std::string
|
|
read_file(std::string path)
|
|
{
|
|
std::ifstream input_file(path);
|
|
if (!input_file.is_open()) {
|
|
fprintf(stderr, "error: could not open file '%s'\n", path.c_str());
|
|
exit(1);
|
|
}
|
|
|
|
return std::string((std::istreambuf_iterator<char>(input_file)), std::istreambuf_iterator<char>());
|
|
}
|