read and delete one line of txt file

Hi, I have a text file on the sd composed by many lines. I wanto to read a line every loop cicle of a while statement , and after delete it. The while will end when avaible() returns true, in other words when there are no line left on the sd. Do you have any suggestion? Thanks

Could you maybe run the question through a translator?

deleting line is very costly, you might better remember the position you are between reading and when you reached the end of file delete the whole file at once.