Use an IDE. They have features like automatic method renaming.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Another option is to just change the definition, try compiling with a compiler, and look at the compiler errors.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Well i guess you can read each line of the file with getline functions and then search for each of your words inside the string. If it is found. you can use the erase function to remove that particular part of the string and then you can now insert your new word in its position.
I think you should post in more code so that we can help you out
Sky Diploma
Practically a Posting Shark
865 posts since Mar 2008
Reputation Points: 673
Solved Threads: 131
Well i guess you can read each line of the file with getline functions and then search for each of your words inside the string. If it is found. you can use the erase function to remove that particular part of the string and then you can now insert your new word in its position.
No, that would be dumb -- you would end up breaking anything with the same name that belonged to another class.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Are you just asking how to do a straight string search and replace?
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Yes, but the string might contain of a substring where only the substring needs to be replaced. For example, in "Hello.World" being one whole string I only want to replace World with "Earth".
What you described (only replacing the "World" part with "Earth") is equivalent to replacing the whole phrase "Hello.World" with the phrase "Hello.Earth".
There are plenty of tools that can do search and replace across a directory for you.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
No, that would be dumb -- you would end up breaking anything with the same name that belonged to another class.
Well when thats what he wanted. I guess thats what we should give. Hence it isnt dumb in any way.
If i had to classes hello and world with member apple.
i would search for hello.apple but not only for apple. :)
Sky Diploma
Practically a Posting Shark
865 posts since Mar 2008
Reputation Points: 673
Solved Threads: 131
that's the main thing there are so many classes that it is impossible to save them in an array but some variable names
We're getting somewhere. Is there a particular reason you need to write this in C++? Would a solution that doesn't use C++ suffice?
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
So just run something like
perl -pi -e 's/foo/bar/g' *.cpp *.h
in every directory. Or maybe something like
find . -name "*.cpp" | xargs perl -pi -e 's/foo/bar/g'
assuming you're running in a unix-like environment. I'm sure you could do something similar in Windows. (Note that 'find' is different on Windows.)
For tasks like this, C++ is not the ideal language.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
I am talking about using commands like perl, xargs, and find, from the command line. You might need to install software if you want to use these on Windows.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177