Import std.ffi.cstring
CString
extend
Extend CString
What a CString does besides ToString: a copy of a String that C code can keep, its length, and giving the copy back.
-
A CString of
text's UTF-8 bytes and a NUL, in memory of its own, which C code can keep until Free gives it back. C reads it up to its first NUL, so a NUL intextends it there.Examples
Local copy = CString.From("hello") Unsafe Expect(copy.Length() == 5) copy.Free() End Unsafe -
How many bytes it has before its first NUL. Panics when it's Null.
-
Gives back what From made, and nothing else, which panics. Null is nothing to give back.
Report an issue with this page or with FutureBlitz on GitHub.