Changing one character in a char[]
This is probably a really silly question but I haven't been able to find an answer... But Visual C++ will not let me do the following code (I get a run-time error):
Code:
// In header file
char *filename;
// In constructor
filename = "frame0000.tif";
// Later in another method
++filename[8]; // This is where I get the error
How can I can I change one character in a string? MSDN says the above code is illegal (even though I know I've done it in other compilers!) but I can't figure out what to do instead. I've also tried initializing filename using strncpy so it will no longer be constant...
Thanks for your help!