diff options
Diffstat (limited to 'zig-embed')
| -rw-r--r-- | zig-embed/Makefile | 5 | ||||
| -rw-r--r-- | zig-embed/main.zig | 14 | ||||
| -rw-r--r-- | zig-embed/max.txt | 7 |
3 files changed, 26 insertions, 0 deletions
diff --git a/zig-embed/Makefile b/zig-embed/Makefile new file mode 100644 index 0000000..d78c528 --- /dev/null +++ b/zig-embed/Makefile @@ -0,0 +1,5 @@ +default: + zig run main.zig + +build: + zig build-exe main.zig diff --git a/zig-embed/main.zig b/zig-embed/main.zig new file mode 100644 index 0000000..a1089b9 --- /dev/null +++ b/zig-embed/main.zig @@ -0,0 +1,14 @@ +const std = @import("std"); + +pub fn main() !void { + const data: []const u8 = @embedFile("max.txt"); + + // Print the whole file out. + std.debug.print("{s}\n", .{data}); + + // Loop over each byte. + for (data) |c| { + std.debug.print("0x{X:0>2} ", .{c}); + } + std.debug.print("\n", .{}); +} diff --git a/zig-embed/max.txt b/zig-embed/max.txt new file mode 100644 index 0000000..5eedd45 --- /dev/null +++ b/zig-embed/max.txt @@ -0,0 +1,7 @@ +"What you've just said is one of the most insanely idiotic things I +have ever heard. At no point in your rambling, incoherent response +were you even close to anything that could be considered a rational +thought. Everyone in this room is now dumber for having listened to +it." + +— Josh Mostel as Principal Max Anderson in Billy Madison (1995) |
