I'm new to C++ and i have to make a recurrent modification over a big project. I have to take all strcpy and strcat methods and convert them into sprintf. I figured out that basically, the conversion would be :
strcpy(out,in) to sprintf(out, "%s", in)
and
strcat(out,in) to do{ int temp = strlen(out); sprintf(out+temp, "%s", in); } while(0)
First question, does that code works?
Second question, there is absolutely no way that the out and in variable could be numerical and that I would need to use %d instead of %s, right?
Third question, the out and in variables will be different in every iteration of the method in all the code I wanna modify, so the modification must be flexible to the variable names. Any way I can do it? It's a VisualStudio 98 project ... But I am on linux ubuntu and windows XP.
Thanks for your time and suggestions!
Oh and don't worry I made a back up of my files :D