string to char*

shd alienballance at gmail.com
Sat Sep 11 06:00:42 PDT 2010


Hello,
I'm having a problem in passing a value to char* expecting function
in D 2.0. Already tried:

to!(char*)("my string");

but it seems like there (Phobos) is no template like this. Then,
tried:

cast(char*)to!(char[])("my string")

which looked ok, but i think it's not a proper way to do that. Most
strings converted this way works properly, but once:

char* string1 = cast(char*)to!(char[])("my string 1");
char* string2 = cast(char*)to!(char[])("my string 2");

resulted:
string1 = "my string 1"
string2 = "my string 1my string 2"

I can't manage this problem, could You hint me?



More information about the Digitalmars-d-learn mailing list