I'm trying to read some lines from a file from the begging and delete those lines after reading them so that next time I don't have to read those which already being read.
The problem is, till now I able to remove the last lines(s) using following code :
This code reads the first line i.e. omes1.xml, but deletes 'omes3.xml' from the end. Is there any solution which will remove only 'omes1.xml' after reading?
Thanks & Regards,
Author and all-around good cowpoke
posted 4 years ago
As you have found, you can cut from the end of a file but:
You can't just reach into the middle of a file and delete data, you have to write a modified file, delete the old and rename.