Is there a way to convert or copy a const char* to a char*? Google has failed me here.
Printable View
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
const_cast?
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.
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.
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;
}
> 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() ?