how to use raw sockets

Jonathan M Davis jmdavisProg at gmx.com
Sun Mar 4 14:05:11 PST 2012


On Sunday, March 04, 2012 22:58:08 maarten van damme wrote:
> -how to convert c strings to d strings

Use std.conv.to.

auto str = to!string(cstr);

> -how to avoid having to call tostringz all the time

You're probably out of luck on this one. If you're passing a string to C, you 
need to convert it to a C string, which means that it needs to be zero-
terminated. The only strings in D which are automatically zero-terminated are 
string literals.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list