Sample code for 30+ languages & platforms
Zig

Example: Http.GetCacheRoot method

Demonstrates the GetCacheRoot method.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    const http = try chilkat.Http.init();
    defer http.deinit();

    // Establish 2 cache root directories.
    http.addCacheRoot("c:/example/httpCacheA/");
    http.addCacheRoot("c:/example/httpCacheB/");

    std.debug.print("Number of cache roots: {d}\n", .{http.getNumCacheRoots()});

    std.debug.print("1st cache root: {s}\n", .{try http.getCacheRoot(alloc, 0)});
    std.debug.print("2nd cache root: {s}\n", .{try http.getCacheRoot(alloc, 1)});

    // Output:

    // Number of cache roots: 2
    // 1st cache root: c:/example/httpCacheA/
    // 2nd cache root: c:/example/httpCacheB/
}