| ... | ... | @@ -4,14 +4,16 @@ pub fn main() !void { |
| 4 | 4 | // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) |
| 5 | 5 | std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); |
| 6 | 6 | |
| 7 | | // Prints to stdout |
| 8 | | const unbuffered_out = std.io.getStdOut().writer(); |
| 9 | | const out = std.io.bufferedWriter(unbuffered_out).writer(); |
| 10 | | try out.print("Run `zig build test` to run the tests.\n", .{}); |
| 11 | | |
| 12 | | // Stdout is for the actual output of your application, for example if you |
| 7 | // stdout is for the actual output of your application, for example if you |
| 13 | 8 | // are implementing gzip, then only the compressed bytes should be sent to |
| 14 | | // stdout, not any debugging messages! |
| 9 | // stdout, not any debugging messages. |
| 10 | const stdout_file = std.io.getStdOut().writer(); |
| 11 | var bw = std.io.bufferedWriter(stdout_file); |
| 12 | const stdout = bw.writer(); |
| 13 | |
| 14 | try stdout.print("Run `zig build test` to run the tests.\n", .{}); |
| 15 | |
| 16 | try bw.flush(); // don't forget to flush! |
| 15 | 17 | } |
| 16 | 18 | |
| 17 | 19 | test "simple test" { |