From c05717e96f53fc7d8272752d6a1e4b5fb338c7a6 Mon Sep 17 00:00:00 2001 From: Blue Date: Sat, 15 Nov 2025 17:20:54 +0100 Subject: [PATCH] Updated hello-world sample to 0.15.1 While the provided code still works, the function writeAll has been deprecated in favor of the writer interface: https://ziglang.org/documentation/0.15.2/std/#std.fs.File.writeAll I think it would be better to update this sample to either a "buffered print", like in this example or a "unbuffered print". --- zig-code/samples/hello-world.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zig-code/samples/hello-world.zig b/zig-code/samples/hello-world.zig index 657939f23..cb988c45f 100644 --- a/zig-code/samples/hello-world.zig +++ b/zig-code/samples/hello-world.zig @@ -1,7 +1,13 @@ const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("hello world!\n"); + var stdout_buffer: [1024]u8 = undefined; + var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer); + const stdout = &stdout_writer.interface; + + try stdout.print("hello world!\n", .{}); + + try stdout.flush(); } // exe=succeed