A89: Re: Re: Re: A C question


[Prev][Next][Index][Thread]

A89: Re: Re: Re: A C question




Hi!

> if(ev->extra.pasteText[strlen(ev->extra.pasteText)-1] == '(')
>   {
>    char *string="";
>    strcpy(string,ev->extra.pasteText);
>    string[strlen(string)-1] = (char)0;
>    ev->extra.pasteText = string;
> }

Huh, what you are doing!!? There is no any space allocated for your
"string" variable: this will cause a crash!!! You need to do:

char string[50];

for example, instead of

char *string="";

Zeljko Juric





Follow-Ups: