const std = @import("std");
const file = @import("std").fs.File;
pub fn meminfo(allocator: std.mem.Allocator) ![]u8 {
const meminfo_file = try std.fs.openFileAbsolute("/proc/meminfo", .{ .mode = .read_only });
const meminfo_file_stat = try meminfo_file.stat();
const meminfo_file_size = meminfo_file_stat.size;
const buffer = try allocator.alloc(u8, meminfo_file_size);
_ = try meminfo_file.read(buffer);
return buffer;
}
test "random test" {
const a = std.testing.allocator;
const meminfo_contents = try meminfo(a);
std.debug.print("{s}", .{meminfo_contents});
}
#why doesn't this print
1 messages · Page 1 of 1 (latest)