zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

wasi_args.zig (409B) - Raw


      1 const std = @import("std");
      2 
      3 pub fn main() !void {
      4     var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
      5     const gpa = general_purpose_allocator.allocator();
      6     const args = try std.process.argsAlloc(gpa);
      7     defer std.process.argsFree(gpa, args);
      8 
      9     for (args, 0..) |arg, i| {
     10         std.debug.print("{}: {s}\n", .{ i, arg });
     11     }
     12 }
     13 
     14 // exe=succeed
     15 // target=wasm32-wasi