Trying to use a Zig library expecting a string... but I get a string buffer from a C library.
That means that I need to pass a value of type [*c]u8 to a function that accepts [:0]const u8.
How to do that?
I found this way so far:
const buffer: [*c]u8 = callC();
const str = std.mem.span(@ptrCast([*:0]const u8, buffer));
Which looks more complicated than it should (and makes a copy??).
The Zig docs says that:
String literals are const pointers to null-terminated arrays of u8.
So I thought they are compatible C strings and a very simple cast like @as([*:0]const u8, buffer) should suffice?