Sample code for 30+ languages & platforms
Zig

Reassemble a Previously Split File

Demonstrates how to reassemble a previously split file.

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 fac = try chilkat.FileAccess.init();
    defer fac.deinit();

    // Any type of file may be reassembled.  It doesn't matter if it's
    // a binary file or a text file.
    const reassembled_filename = "hamlet2.xml";

    const part_prefix = "hamlet";
    const part_extension = "spl";
    const src_dir_path = ".";

    // Reassembles the original file from hamlet1.spl, hamlet2.spl, ...

    if (fac.reassembleFile(src_dir_path, part_prefix, part_extension, reassembled_filename)) {
        std.debug.print("Success.\n", .{});
    } else |_| {
        std.debug.print("{s}\n", .{try fac.getLastErrorText(alloc)});
    }
}