8 std::ifstream file(path, std::ios::in);
11 throw std::runtime_error(
"failed to open file " + path.string());
13 const long int fileSize = file.tellg();
16 throw std::runtime_error(
"file " + path.string() +
" is empty");
18 std::vector<char> buffer(
static_cast<long unsigned int>(fileSize));
19 file.seekg(0, std::ios::beg);
20 if (!file.read(buffer.data(), fileSize))
22 throw std::runtime_error(
"failed to read file " + path.string());