Function mallocedStringz

Uses C's malloc to allocate a copy of original with an attached zero terminator. It may return a slice with a null pointer (but non-zero length!) if malloc fails and you are responsible for freeing the returned pointer with core.stdc.stdlib.free(ret.ptr).

char[] mallocedStringz(
  in const(char[]) original
);

I strongly recommend you use [CharzBuffer] or Phobos' [std.string.toStringz] instead unless there's a special reason not to.

See Also

[CharzBuffer] for a generally better alternative. You should only use mallocedStringz where CharzBuffer cannot be used (e.g. when druntime is not usable or you have no stack space for the temporary buffer).

[mallocSlice] is the function this function calls, so the notes in its documentation applies here too.