Relative Content

Tag Archive for zig

How to iterate over the file and directories of the given path and no need to include sub_directories in zig

const std = @import(“std”); pub fn main() !void { const path = “.”; const allocator = std.heap.page_allocator; var dir = try std.fs.cwd().openDir(path, .{ .iterate = true }); defer dir.close(); var walker = try dir.walk(allocator); defer walker.deinit(); std.debug.print(“n”, .{}); while (try walker.next()) |entry| { std.debug.print(“File Name: {s}n”, .{entry.basename}); } } I tried above code which iterate […]