A debug class has started

drug drug2004 at bk.ru
Mon Dec 13 11:09:18 UTC 2021

On 13.12.2021 13:49, forkit wrote:
> On Monday, 13 December 2021 at 09:49:05 UTC, forkit wrote:
>> ....
> char* w = cast(char*)str.toStringz; // this seems to be the solution
> class has ended ;-)

That's because `str` is initialized by a literal and you can not change 
it by definition. When you call `toStringz` it duplicates that literal 
(adding terminating zero at the end) and the duplicate is mutable. I 
would recommend do not use `toStringz` and just make duplicate of the 
literal - https://run.dlang.io/is/vaosW0

More information about the Digitalmars-d-learn mailing list