Is there a way to convert or copy a const char* to a char*? Google has failed me here.
Is there a way to convert or copy a const char* to a char*? Google has failed me here.
Ummmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm mmmmmmmm.
strcpy http://www.cplusplus.com/ref/cstring/strcpy.html
Woop?
const_cast?
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
strcpy won't work with a const char* , and const_cast seems kind of unreliable.
edit: I mean the strcpy in the source code for a game I'm modding. It has its own version.
Last edited by DmD; 12-22-2005 at 10:23 PM.
Okay let's play 20 questions. Or not. Why don't you post a minimal snippet of code that demonstrates what it is you are attempting to accomplish.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Fine I will write it for you.
My life is now complete.Code:char *strcpy(char *dest, const char *src) { int i; for(i = 0; src[i] != '\0'; i++) { dest[i] = src[i]; } dest[i] = '\0'; return dest; }
Woop?
> Is there a way to convert or copy a const char* to a char*?
Lemme guess, it's the result of the c_str() method on one of your strings?
> I mean the strcpy in the source code for a game I'm modding. It has its own version.
So use it.
Or does it have a completely different signature compared to the ANSI-C strcpy() ?