From 46cf88f53a85e38f56a68dc0a8d4b322eef3a618 Mon Sep 17 00:00:00 2001 From: CasualYT31 <21147925+CasualYT31@users.noreply.github.com> Date: Wed, 14 Jul 2021 18:35:33 +0100 Subject: [PATCH] Fixing bugs --- SystemProperties.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/SystemProperties.cpp b/SystemProperties.cpp index 9c4fc76..0de05f9 100644 --- a/SystemProperties.cpp +++ b/SystemProperties.cpp @@ -22,7 +22,6 @@ SOFTWARE.*/ #include "SystemProperties.hpp" #include -#include std::uint64_t sys::convert(const std::uint64_t bytes, const sys::unit unit) { switch (unit) { @@ -201,9 +200,8 @@ std::string sys::storage::capacity(const sys::unit unit) { std::ifstream ifs(tempfile); std::string ret; // skip first three lines, read fourth line - for (int x = 0; x < 4; x++) std::getline(ifs, ret); - std::cout << ret << std::endl; - std::uint64_t count = std::stoll(ret); + for (int x = 0; x < 3; x++) std::getline(ifs, ret); + std::uint64_t count = std::stoll(getcleanline(ifs)); ifs.close(); remove(tempfile.c_str()); cache = std::to_string(sys::convert(count, unit)) + sys::notation(unit); @@ -218,8 +216,8 @@ std::string sys::storage::free(const sys::unit unit) { std::ifstream ifs(tempfile); std::string ret; // skip first three lines, read fourth line - for (int x = 0; x < 4; x++) std::getline(ifs, ret); - std::uint64_t count = std::stoll(ret); + for (int x = 0; x < 3; x++) std::getline(ifs, ret); + std::uint64_t count = std::stoll(getcleanline(ifs)); ifs.close(); remove(tempfile.c_str()); cache = std::to_string(sys::convert(count, unit)) + sys::notation(unit);