mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +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
|
@ -21,13 +21,13 @@ int main(int argc, char** argv)
|
|||
UNUSED_PARAM(argc);
|
||||
UNUSED_PARAM(argv);
|
||||
|
||||
CFile file("/proc/net/adapters");
|
||||
if (!file.open(CIODevice::ReadOnly)) {
|
||||
fprintf(stderr, "Error: %s\n", file.error_string());
|
||||
auto file = CFile::construct("/proc/net/adapters");
|
||||
if (!file->open(CIODevice::ReadOnly)) {
|
||||
fprintf(stderr, "Error: %s\n", file->error_string());
|
||||
return 1;
|
||||
}
|
||||
|
||||
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 if_object = value.as_object();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue