string from C function

Python python at python.com
Thu May 8 08:21:02 UTC 2025


On Thursday, 8 May 2025 at 04:51:27 UTC, Andy Valencia wrote:
>
> Thank you.  I want to work in strings, so the first one's not 
> an option.  But both the second and third do the trick.  Would 
> you say the to!string would be the most idiomatic?  It worked 
> as "to!string(ctime(&t))", but is it safe to assume it's 
> reliably dealing with null-terminated strings?  It's the 
> pithiest if so.
>
> Andy

Yes, it'safe to assume:

https://github.com/dlang/phobos/blob/12bcacca2a590942e1b917daaa8732a509b2ef30/std/conv.d#L1087


More information about the Digitalmars-d-learn mailing list