Calling C functions that modify a string

bachmeier no at spam.net
Thu Jun 15 18:21:07 UTC 2023


On Thursday, 15 June 2023 at 15:53:57 UTC, Steven Schveighoffer 
wrote:
> On 6/15/23 10:04 AM, Jonathan M Davis wrote:
>> On Thursday, June 15, 2023 7:18:06 AM MDT Steven Schveighoffer 
>> via
>> Digitalmars-d-learn wrote:
>>> But in general, if you want a mutable character array that's 
>>> zero
>>> terminated, you need to make a copy with a zero terminator, 
>>> but type it
>>> as mutable. I'm surprised there isn't a way to do this easily 
>>> in the
>>> library.
>> 
>> https://dlang.org/phobos/std_utf.html#toUTFz
>> 
>
> Oh nice, so `toUTFz!char` should work. Thanks!
>
> -Steve

Shouldn't it be `toUTFz!(char*)`? That's what I've been using to 
pass strings to C after someone here recommended it.


More information about the Digitalmars-d-learn mailing list