Skip to content
FutureBlitz

    Install

    Import std.ffi.cstring

    std.ffi.cstring

    What a CString does besides ToString, which is built in: a copy of a String that C code can keep, its length, and giving the copy back. The copy is the runtime's, like the one an Extern Function's call makes of a String argument, so leak reports count one that's never freed.

    std/ffi/cstring.fb

    Extends

    CString extend

    Extend CString

    No doc comment.

    std/ffi/cstring.fb, line 11

    • Public Static Method From(text: String): CString static method #

      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 in text ends it there.

    • @PanicsAtCaller Public Unsafe Method Length(): Int64 method #

      How many bytes it has before its first NUL. Panics when it's Null.

    • @PanicsAtCaller Public Unsafe Method Free() method #

      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.