fromStringzN

fnstring fromStringzN(const(char) * cstr, size_t maxLen) @trusted pure nothrow

Converts a null-terminated C string to a D string with known maximum length.

This is safer when the string might not be properly null-terminated within the expected buffer size.

Parameters

cstrPointer to the C string
maxLenMaximum number of characters to read

Returns

A D string copy of the C string