This commit is contained in:
gabime
2025-05-08 13:32:53 +03:00
parent 548b264254
commit 493f5b0581
4 changed files with 92 additions and 17 deletions

View File

@@ -50,10 +50,9 @@ void require_message_count(const std::string &filename, const std::size_t messag
std::size_t get_filesize(const std::string &filename) {
std::ifstream ifs(filename, std::ifstream::ate | std::ifstream::binary);
if (!ifs) {
throw std::runtime_error("Failed open file ");
throw std::runtime_error("Failed open file " + filename);
}
return static_cast<std::size_t>(ifs.tellg());
return ifs.tellg();
}
// source: https://stackoverflow.com/a/2072890/192001