From 6f2bf26ce16c574a87fc128403119b9690caefc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 7 May 2023 20:46:05 +0200 Subject: [PATCH] Do the seekg thing --- src/openrct2-ui/windows/Changelog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 39165e71f3..5e018d2849 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -73,7 +73,9 @@ public: { throw std::runtime_error("Unable to open " + path); } - auto length = fs.end - fs.beg; + fs.seekg(0, fs.end); + auto length = fs.tellg(); + fs.seekg(0, fs.beg); std::unique_ptr buffer = std::make_unique(length); fs.read(buffer.get(), length); auto result = std::string(buffer.get(), buffer.get() + length);