Function toStringzNGC
Convert a D string to a C style null terminated pointer
auto mecca .lib .string .toStringzNGC toStringzNGC
(
string dString
);
The function uses a static buffer in order to keep the string whie needed. The function's return type is a custom type that tracks the
life time of the pointer. This type is implicitly convertible to char*
for ease of use.
Most cases can use the return type as if it is a pointer to char:
fcntl
If keeping the pointer around longer is needed, it should be stored in a variable of type auto
:
auto fileNameC = toStringzNGC(fileName);
This can be kept around until end of scope. It can be released earlier with the release
function:
fileNameC
Parameters
Name | Description |
---|---|
dString | the D string to be converted to zero terminated format. |
Returns
A custom type with a destructor, a function called release()
, and an implicit conversion to char*
.