get rid of read to str
This commit is contained in:
@@ -28,9 +28,10 @@ void sys::getTimeDate(TimeDate* td) {
|
||||
}
|
||||
|
||||
void sys::getRam(Memory* mem) {
|
||||
auto content = readFileToStr("/proc/meminfo", 128); // file is longer than that but its all we need
|
||||
mem->free = getVal("MemAvailable:", content);
|
||||
mem->total = getVal("MemTotal:", content);
|
||||
static char buf[128]; // file is longer but we only need first 128 chars
|
||||
readFile("/proc/meminfo", buf, sizeof(buf));
|
||||
mem->free = getVal("MemAvailable:", std::string_view(buf));
|
||||
mem->total = getVal("MemTotal:", std::string_view(buf));
|
||||
mem->used = mem->total - mem->free;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user