zig.guide icon indicating copy to clipboard operation
zig.guide copied to clipboard

Update 03.filesystem-cwd-create.zig

Open bacher opened this issue 5 months ago • 0 comments

In the Filesystem guide https://zig.guide/standard-library/filesystem/ the first code snippet is not logically valid.

The line:

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.

bacher avatar Sep 04 '24 08:09 bacher