[erlang-questions] Read and delete file

maruthavanan s <>
Sat Dec 12 11:18:50 CET 2009


Hi,

The file is huge so I cannot take and keep it in memory.

Regards,
Marutha

> To: 
> From: 
> CC: 
> Date: Fri, 11 Dec 2009 15:44:52 +0100
> Subject: Re: [erlang-questions] Read and delete file
> 
> 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
> >  		 	   		  
> 
> 
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
> 
 		 	   		  


More information about the erlang-questions mailing list