From f0daeff8d8a5e1c584227c6dbeabf4b664c09ae3 Mon Sep 17 00:00:00 2001 From: Ilia Lebedev Date: Wed, 4 Sep 2024 10:20:09 +0200 Subject: [PATCH] Update 03.filesystem-cwd-create.zig In the Filesystem guide https://zig.guide/standard-library/filesystem/ the first code snippet is not logically valid. The line: ```zig const bytes_written = try file.writeAll("Hello File!"); ``` is not correct, because `file.writeAll` has return type of `WriteError!void`, so variable `bytes_written` is always `void` in this case. `bytes_written` can be gotten if we replace `writeAll` by `write`, but I don't think we want to do that in this example. --- .../02-standard-library/03.filesystem-cwd-create.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/versioned_docs/version-0.13/02-standard-library/03.filesystem-cwd-create.zig b/website/versioned_docs/version-0.13/02-standard-library/03.filesystem-cwd-create.zig index febfa46..d875aca 100644 --- a/website/versioned_docs/version-0.13/02-standard-library/03.filesystem-cwd-create.zig +++ b/website/versioned_docs/version-0.13/02-standard-library/03.filesystem-cwd-create.zig @@ -10,8 +10,7 @@ test "createFile, write, seekTo, read" { ); defer file.close(); - const bytes_written = try file.writeAll("Hello File!"); - _ = bytes_written; + try file.writeAll("Hello File!"); var buffer: [100]u8 = undefined; try file.seekTo(0);