Calling C functions that modify a string

Steven Schveighoffer schveiguy at gmail.com
Thu Jun 15 18:38:01 UTC 2023


On 6/15/23 2:21 PM, bachmeier wrote:
> 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!
>>
> 
> Shouldn't it be `toUTFz!(char*)`? That's what I've been using to pass 
> strings to C after someone here recommended it.

Yep. I didn't read so good...

-Steve


More information about the Digitalmars-d-learn mailing list