From: Tim Heaney Date: 2005-01-24T02:35:53+09:00 Subject: Re: File.read not returning nil [newbie] Navindra Umanee writes: > > Just so that I'm clear. You tried this: > > File.open("/dev/null") { |file| > print "file.read should return nil\n" if file.eof? > print "file.read: " > print file.read > print "\n" > } > > and got it to print the empty string? That's right, yes. $ cat fileread.rb #!/usr/local/bin/ruby -w File.open("/dev/null") { |file| print "file.read should return nil\n" if file.eof? print "file.read: " print file.read print "\n" } $ ./fileread.rb file.read should return nil file.read: