From: daz Date: 2003-06-05T14:37:40+09:00 Subject: Re: ios.gets doesn't seem to work as advertised "Richard" wrote: > I've got the following script in a Win2000SP3 environment running Ruby > 1.6.8: > > [snip] > > while rec = File.new(fullFileName).gets("\r\n") > puts "Record: "+rec > end > > [snip] > > Any suggestions? > > TIA, > Richard You're re-opening the file each time and reading the the whole (haven't examined why) file. This should do it ... File.open('test.dat') do |fi| while rec = fi.gets puts "Record: " << rec end end # Record: AAA # Record: BBB # Record: CCC daz