C++ Delete all under line

Hi!
I need help. I have a simple text file (test.txt)
In this file, is any text.. Like
1
2
3
sdgg
dsgsgsdg
gdsgsgs asdjsdf asl fa

And after this is there
1
2
3
4
 deletethis
dfgs
gsdgsd
gsdgsdgsd sg sdg


How can i delete all under line "deletethis" from text file, with c++ ?
You create a copy of the file by reading in one line at a time and outputting to the new file one line at a time.

When you read in "deletethis", you close both files, delete the original file, rename the new file to the name of the original file.
OH thank you. I am so stupid XD
Registered users can post here. Sign in or register to post.