[erlang-questions] Read and delete file

Mazen Harake <>
Sun Dec 13 07:40:41 CET 2009


Hi,

May I ask why you need to remove the first line?

In some cases I've been involved in something similar we have done one 
of the following (AFAIR):
* Don't delete the line, move an index. If need for failover handling 
then make the index value persistent
* Write to a "rest" file meaning that assuming you are reading line by 
line (and not deleting) you can (when finished) write the rest of the 
file to another file, close the one you have opened and then overwrite 
it with the temporary one.

Regards,

/Mazen

On 11/12/2009 15:50, maruthavanan s wrote:
> Hi,
>
> I am opening a file using file and I read the file line by line using io:get_line.
> But after reading this line I need to delete the read line from the file.
>
> Appreciate you help.
>
> Thanks,
> Marutha
>   		 	   		
>    



More information about the erlang-questions mailing list