We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a6ed95b commit 9a60306Copy full SHA for 9a60306
src/rp/toolbox.cpp
@@ -30,19 +30,15 @@ std::string verbosity_to_string(const VerbosityLevel lvl) {
30
31
// Get the size of an open file without changing its position
32
std::streampos get_file_size(std::ifstream &file) {
33
-
34
- // Save the current file ptr position
35
std::streampos backup = file.tellg();
36
37
- // Move the ptr to the end
38
- file.seekg(0, std::ios::end);
39
40
- // Get the current file ptr position ( start = 0 + EOF )
+ file.seekg(0, std::ios::beg);
41
std::streampos fsize = file.tellg();
42
43
- // Restore the previous ptr position
44
- file.seekg(backup);
+ file.seekg(0, std::ios::end);
+ fsize = file.tellg() - fsize;
45
+ file.seekg(backup);
46
return fsize;
47
}
48
0 commit comments