Path.toStringz

Return path as 0-terminated string. Usually, could be used to interface with C libraries.

Important Note: When passing a char* to a C function, and the C function keeps it around for any reason, make sure that you keep a reference to it in your D code. Otherwise, it may become invalid during a garbage collection cycle and cause a nasty bug when the C code tries to use it.

struct Path
pure nothrow const
toStringz
()

Examples

import dshould;
import core.stdc.string: strlen;

const auto p = Path("test");
auto sz = p.toStringz;

strlen(sz).should.equal(4);
sz[4].should.equal('\0');

Meta