[erlang-questions] Read and delete file

Bengt Kleberg bengt.kleberg@REDACTED
Fri Dec 11 15:44:52 CET 2009


Greetings,

The simplest way, if you can have the whole file in memory, would be to
read all lines, handle a single line and then write all the remaining
lines out to the file. Then repeat.
Use file:read_file/1 (split the line from the binary) and
file:write_file/2.


bengt

On Fri, 2009-12-11 at 08:50 -0500, 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