Delete/Overwire Lines from a text file
I want to overwrite or delete the last 'x' lines of a text file.
I don't mind if they are deleted and then I write new data or if they are just overwritten as the new data in entered.
Alternatively, I could open a new file. Copy the contents of the file with the info over to this new file, minus the last 20 lines. Then I can delete the original file and then rename the new file as the same name of the file I just deleted.
Can anyone help me with this? Which do you think would be easiest to implement?
I think the 3rd method of creating a new file could be easiest but is there a function which I can use which will allow me to copy over the lines of the file - the last 'x' lines?