From: Daniel N Date: 2006-10-13T15:42:04+09:00 Subject: Re: Large File Reading and Writing ------=_Part_63348_6683847.1160721721509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanx. I'm not sure that my head is really around it though... Pls see inline On 10/13/06, Joel VanderWerf wrote: > > Something like this maybe... > > history = [] > ARGF.each do |line| > history << line > if enough_history_to_generate_some_output > write_output > history.clear > end > end Does the output file not stay in memory? In my case the output file is almost a concatenation of large files so once I've written a line I don't really want to keep that line in memory. The ARGF thingy is explained in 'ri IO': > > The global constant ARGF (also accessible as $<) provides an > IO-like stream which allows access to all files mentioned on the > command line (or STDIN if no files are mentioned). ARGF provides > the methods #path and #filename to access the name of the file > currently being read. > > You can of course open a file by name from your code. If I have a named file and I open it. I think it will be easier if I open specify the files from withing ruby by feeding it only a directory. Once I have my list of files if I open a file File.open( "my_file", "r" ) Is there a way to buffer this input so that the entire file is not read? Sorry if this is implicit in your last reply but I don't understand it if it is. Cheers ------=_Part_63348_6683847.1160721721509--