diff options
author | sadbeast <sadbeast@sadbeast.com> | 2024-04-15 18:08:28 -0700 |
---|---|---|
committer | sadbeast <sadbeast@sadbeast.com> | 2024-05-18 17:23:35 -0700 |
commit | a4711cad923d6c7480e596685d9dcaefa241fe3b (patch) | |
tree | f0c36edea9b32b8a1825270436868bb020689657 /example/src/main.zig | |
download | tmz-main.tar.gz tmz-main.tar.bz2 |
Diffstat (limited to 'example/src/main.zig')
-rw-r--r-- | example/src/main.zig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/example/src/main.zig b/example/src/main.zig new file mode 100644 index 0000000..44fa08f --- /dev/null +++ b/example/src/main.zig @@ -0,0 +1,19 @@ +const std = @import("std"); +const tmz = @import("tmz"); + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + const allocator = gpa.allocator(); + defer _ = gpa.deinit(); + + const parsed_map = try tmz.parseMap(allocator, @embedFile("map.tmj")); + defer parsed_map.deinit(); + + const stdout_file = std.io.getStdOut().writer(); + var bw = std.io.bufferedWriter(stdout_file); + const stdout = bw.writer(); + + try stdout.print("Map: {any}\n", .{parsed_map.value}); + + try bw.flush(); // don't forget to flush! +} |