mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:37:35 +00:00
LibCore: Convert CFile to ObjectPtr
This commit is contained in:
parent
31b38ed88f
commit
8d550c174e
30 changed files with 135 additions and 134 deletions
|
@ -19,14 +19,14 @@ struct FileSystem {
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
CFile file("/proc/df");
|
||||
if (!file.open(CIODevice::ReadOnly)) {
|
||||
fprintf(stderr, "Failed to open /proc/df: %s\n", file.error_string());
|
||||
auto file = CFile::construct("/proc/df");
|
||||
if (!file->open(CIODevice::ReadOnly)) {
|
||||
fprintf(stderr, "Failed to open /proc/df: %s\n", file->error_string());
|
||||
return 1;
|
||||
}
|
||||
printf("Filesystem Blocks Used Available Mount point\n");
|
||||
|
||||
auto file_contents = file.read_all();
|
||||
auto file_contents = file->read_all();
|
||||
auto json = JsonValue::from_string(file_contents).as_array();
|
||||
json.for_each([](auto& value) {
|
||||
auto fs_object = value.as_object();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue