On Sunday, 15 August 2021 at 08:47:39 UTC, jfondren wrote:

dup() isn't aware of the NUL since that's outside the slice of the string. It only copies the chars in "John". You can use toStringz to ensure NUL termination:
https://dlang.org/phobos/std_string.html#.toStringz

Is there something bad than just casting it to `char*` that I should be aware of?

Reply via email to