Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 03.filesystem-cwd-create.zig #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bacher
Copy link

@bacher bacher commented Sep 4, 2024

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant