hi
i have a file with this text in it : "hi , how are you? are you ok?"
i want add a word like TODAY after "are" without lose other words.
how can do it?
i do not want use temp file.
hi
i have a file with this text in it : "hi , how are you? are you ok?"
i want add a word like TODAY after "are" without lose other words.
how can do it?
i do not want use temp file.
Last edited by aminpost; 12-01-2009 at 11:11 AM.
read contents of the file into string, modify string, write string back to file
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
like this?Code:std::string test = "a"; test += "b";
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Probably you'd want to use the insert member function to insert the word you wish to add to the string once you find where in the string the insert is to take place.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens