Printing a C "string" with write(f)ln

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 9 14:35:37 PST 2016


On Tuesday, 9 February 2016 at 16:58:03 UTC, Daniel Kozak wrote:
>> Or use `to` like this:
>>
>> import std.conv;
>> writefln("%s", pString.to!(string));
>
> this will allocate new string which can be performance problem.

Which is good in most cases. It's better to have the GC take care 
of the D string instead of worrying about the lifetime of pString.


More information about the Digitalmars-d-learn mailing list