toOwnedCString

fnconst(char) * toOwnedCString(string s) nothrow

Converts a D string to a null-terminated C string backed by owned GC memory.

Unlike toCString, the returned pointer remains valid even after the original D string is garbage-collected, because the data is copied into a new GC allocation.

Parameters

sThe D string to convert.

Returns

A null-terminated C string backed by owned GC memory, or null on allocation failure.