Get Current Working Directory

Examples Filter
const std = @import("std");

pub fn main() !void {
    // allocate a large enough buffer to store the cwd
    var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
    
    // getcwd writes the path of the cwd into buf and returns a slice of buf with the len of cwd
    const cwd = try std.os.getcwd(&buf);

    // print out the cwd
    std.debug.warn("cwd: {}", .{cwd}); 
}