Use std.fmt.allocPrintZ
for future reference:
Allocator.dupeZ, orAllocator.allocSentinalif you want a non zero terminator- you can also
slice[a..b :0], to make a slice with a sentinel from a non sentinel slice, note that zig will not set the actual value after the slice to the sentinal, but will (in safe builds) assert that it is already set correctly, so set it before you convert to a terminated slice. @ptrCastshould be avoided, but does work