Hi
I'm having a very basic newbie problem,
The compiler forces me to do a strdup (because of cons correctness),
can I void the extra line in my code, and then I cant seem to update my array
after the funciton call
void fix_name(char *name){
if(name[strlen(name)-1]!='/'){
char *tmp = new char[(strlen(name)+1)];
strcpy(tmp,name);
tmp[strlen(name)] = '/';
printf("%s\n",tmp);
name=tmp;
}
}
int main(int argc, char** argv){
const char* sds = "asf/asdf";
const char* sdsd =strdup(sds)
printf("%s\n",sdsd);
(fix_name(sdsd));
printf("%s\n",sdsd);
return 0;
}