How do you change curtan text in a text file?


example:
I have the user enter there name into data.txt and then have them enter there age in to data.txt.

Then they grow up and they enter there age again, but instead of redoing the whole thing, I want it to replace lets say: ' 21 ' into ' 22 '.


Any1?

Thnx in advance

If the database.txt file is like most other text files in most cases you will just have to rewrite the whole file in order to change just one word. But, if you just want to change one word with another word of the same length you could first locate the word to be changed, back up to the beginning of that word then write the new word. Exactly how to do that depends on C or C++ language.