summaryrefslogtreecommitdiff
path: root/zig-embed/main.zig
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-09-19 06:53:00 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-09-19 06:53:00 +0200
commit1be35411cf23c1b8cc909c2f2e1d1030e2f5015a (patch)
tree3316f9733f0d4b83b34dc6074efe48e8a2006048 /zig-embed/main.zig
parent03b412953637b7a6c5d7513993a28294c8afef29 (diff)
downloadprobe-1be35411cf23c1b8cc909c2f2e1d1030e2f5015a.tar.gz
Added embedding of files into compiled binary with Zig
Diffstat (limited to 'zig-embed/main.zig')
-rw-r--r--zig-embed/main.zig14
1 files changed, 14 insertions, 0 deletions
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", .{});
+}