string to char*

Mariusz Gliwiński alienballance at gmail.com
Sat Sep 11 06:50:16 PDT 2010


On 2010-09-11 15:13, Simen kjaeraas wrote:
> Why does the function expect a char*? If it is an external C function,
> and it might change the passed values, you should make a duplicate
> mutable string, or use char[] in lieu of string.
>
> If it is an external C function that will *not* change the passed
> values, and you have write access to the D headers to interface to C,
> use const char* instead. If no write access, I would use
> cast(char*)myString.ptr.

Yes, it's external C function and I can modify bindings (just bindings, 
not ABI). Now I'll trace back library which is interfacing to me and 
possibly fix bindings.

You helped me already, thanks a lot. I can already go on (this language 
is so cool btw.).


More information about the Digitalmars-d-learn mailing list