From a4711cad923d6c7480e596685d9dcaefa241fe3b Mon Sep 17 00:00:00 2001 From: sadbeast Date: Mon, 15 Apr 2024 18:08:28 -0700 Subject: initial mistake --- example/src/main.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 example/src/main.zig (limited to 'example/src/main.zig') 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! +} -- cgit v1.2.3