C++: Difference between revisions
Line 105: | Line 105: | ||
#include <cerrno> | #include <cerrno> | ||
std::string get_file_contents( | std::string get_file_contents(std::string filename) | ||
{ | { | ||
std::ifstream in(filename, std::ios::in | std::ios::binary); | std::ifstream in(filename, std::ios::in | std::ios::binary); | ||
Line 115: | Line 115: | ||
in.seekg(0, std::ios::beg); | in.seekg(0, std::ios::beg); | ||
in.read(&contents[0], contents.size()); | in.read(&contents[0], contents.size()); | ||
return contents; | |||
return | |||
} | } | ||
throw(errno); | throw(errno); |