C++ file handling | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ file handling

Hi guys. Can someone explain me , how to change data in a cartain line: File.txt Mike John Carl HOW CAN I GET TO THE SECOND LINE AND CHANGE JOHN INTO MARK.

17th Mar 2021, 10:07 AM
Hammad Yaqub
Hammad Yaqub - avatar
3 Answers
17th Mar 2021, 12:24 PM
Daniel Vetter
Daniel Vetter - avatar
0
You cant go to a specific Line and Edit it, what you could do is search of a String (in this case "Mark") and then change it to "John". If you want to delete a line in the middle of a file you will have to re-write the subsequent lines.
17th Mar 2021, 10:54 AM
Daniel Vetter
Daniel Vetter - avatar
0
How can I do that
17th Mar 2021, 11:12 AM
Hammad Yaqub
Hammad Yaqub - avatar