From 708436c63d8593dfa05ed358768ab7f5ba4ae840 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Wed, 1 Jul 2026 16:20:41 +0200 Subject: [PATCH 1/2] added explanation about stdout --- exercises/026_hello2.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exercises/026_hello2.zig b/exercises/026_hello2.zig index f110d87..dc1e019 100644 --- a/exercises/026_hello2.zig +++ b/exercises/026_hello2.zig @@ -30,3 +30,11 @@ pub fn main(init: std.process.Init) !void { // We just learned of a single statement which can accomplish this. stdout.print("Hello world!\n", .{}); } + +// Now you must be thinking "Why would I need to do this instead of good +// old `std.debug.print()`?", but here's what you need to understand: +// `std.debug.print()` prints its output to stderr, while the stdout_writer +// approach prints to stdout. +// A common practice is to pipe output of a command to other commands, +// and in order for the piping to work, those commands expect thier input +// to come from stdout, not stderr. From ba99eea43b6432ef81a55125bc65a7161361a329 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Wed, 1 Jul 2026 16:28:04 +0200 Subject: [PATCH 2/2] created also new patch file --- exercises/026_hello2.zig | 4 ++-- patches/patches/026_hello2.patch | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/exercises/026_hello2.zig b/exercises/026_hello2.zig index dc1e019..31f1232 100644 --- a/exercises/026_hello2.zig +++ b/exercises/026_hello2.zig @@ -32,8 +32,8 @@ pub fn main(init: std.process.Init) !void { } // Now you must be thinking "Why would I need to do this instead of good -// old `std.debug.print()`?", but here's what you need to understand: -// `std.debug.print()` prints its output to stderr, while the stdout_writer +// old 'std.debug.print()'?", but here's what you need to understand: +// 'std.debug.print()' prints its output to stderr, while the stdout_writer // approach prints to stdout. // A common practice is to pipe output of a command to other commands, // and in order for the piping to work, those commands expect thier input diff --git a/patches/patches/026_hello2.patch b/patches/patches/026_hello2.patch index 85f02a7..95fe79e 100644 --- a/patches/patches/026_hello2.patch +++ b/patches/patches/026_hello2.patch @@ -1,9 +1,11 @@ ---- exercises/026_hello2.zig 2026-01-09 22:51:45.803358789 +0100 -+++ answers/026_hello2.zig 2026-01-09 22:50:46.016166527 +0100 -@@ -28,5 +28,5 @@ +--- exercises/026_hello2.zig 2026-07-01 16:27:18.674459266 +0200 ++++ answers/026_hello2.zig 2026-07-01 16:27:08.579220702 +0200 +@@ -28,7 +28,7 @@ // to be able to pass it up as a return value of main(). // // We just learned of a single statement which can accomplish this. - stdout.print("Hello world!\n", .{}); + try stdout.print("Hello world!\n", .{}); } + + // Now you must be thinking "Why would I need to do this instead of good