Thread overview
from char* to char[]
Sep 04, 2003
manfred
Sep 04, 2003
Walter
Sep 04, 2003
manfred
September 04, 2003
Hello,

int main() {
char[] string;
char *query = "Test";
printf("query = %s \n",query);
string = *cast(char[]*)query;      //how to cast ?
//strcpy(string,cast(char[]*)query);
printf("string = %.*s \n",string);
printf("\n");
return 0;
}

When i start the programm the variable string didn't print "Test" .

Manfred Hansen


September 04, 2003
<manfred@toppoint.de> wrote in message news:bj6mcg$2cnk$1@digitaldaemon.com...
> Hello,
>
> int main() {
> char[] string;
> char *query = "Test";
> printf("query = %s \n",query);
> string = *cast(char[]*)query;      //how to cast ?
> //strcpy(string,cast(char[]*)query);
> printf("string = %.*s \n",string);
> printf("\n");
> return 0;
> }
>
> When i start the programm the variable string didn't print "Test" .

try:
    import string;
    ...
    string = query[0..strlen(query)];


September 04, 2003
Yes, that what i want.
Thank you.

Manfred

In article <bj6ndl$2e47$3@digitaldaemon.com>, Walter says...
>
>
><manfred@toppoint.de> wrote in message news:bj6mcg$2cnk$1@digitaldaemon.com...
>> Hello,
>>
>> int main() {
>> char[] string;
>> char *query = "Test";
>> printf("query = %s \n",query);
>> string = *cast(char[]*)query;      //how to cast ?
>> //strcpy(string,cast(char[]*)query);
>> printf("string = %.*s \n",string);
>> printf("\n");
>> return 0;
>> }
>>
>> When i start the programm the variable string didn't print "Test" .
>
>try:
>    import string;
>    ...
>    string = query[0..strlen(query)];
>
>