Function cWriter [src]
Alias for std.io.c_writer.cWriter
Prototype
pub fn cWriter(c_file: *std.c.FILE) CWriter
Parameters
c_file: *std.c.FILE
Example
test cWriter {
if (!builtin.link_libc or builtin.os.tag == .wasi) return error.SkipZigTest;
const filename = "tmp_io_test_file.txt";
const out_file = std.c.fopen(filename, "w") orelse return error.UnableToOpenTestFile;
defer {
_ = std.c.fclose(out_file);
std.fs.cwd().deleteFileZ(filename) catch {};
}
const writer = cWriter(out_file);
try writer.print("hi: {}\n", .{@as(i32, 123)});
}
Source
pub fn cWriter(c_file: *std.c.FILE) CWriter {
return .{ .context = c_file };
}