From: RichardLMuller@... (Richard) Date: 2003-06-05T13:17:30+09:00 Subject: ios.gets doesn't seem to work as advertised 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 for a file whose content is say: AAA BBB CCC with \r\n as the record separator (determined by viewing with a hex editor). What I expected is: Record: AAA Record: BBB Record: CCC What I got is: Record: AAA BBB CCC Record: AAA BBB CCC [ad nauseum] So it appears that IO$gets returns a array of "lines" again and again, rather than each "line" successively, as described in Programming Ruby. The kernel$gets works by returning individual lines and recognizes the \r\n delimiter automatically. I had to go to the IO version because I wanted to read from multiple files and needed to know the name of the file being read, which didn't seem possible if I passed an array to ARGV. Resetting ARGV with different filenames was flagged as an error. I don't want to read the entire file into memory for several reasons. My application may encounter excessively large files. Secondly, my application runs in a thread that processes the latest records added to the file and idles when there are no new records to be inspected. Any suggestions? TIA, Richard