From: Florian Gross Date: 2005-01-23T22:40:54+09:00 Subject: Re: File.read not returning nil [newbie] Navindra Umanee wrote: > Hi Florian, Moin. >>irb(main):009:0> File.open("NUL") { |f| f.read } >>=> "" > > I am completely confused. The documentation says it should print nil: > > http://www.rubycentral.com/book/ref_c_io.html#IO.read > > It does return nil in my first test case. It does not return nil in > my second test case which is identical to your test case and as far as > I can see shows the same problem. > > So why the difference in behavior? It's still completely baffling me. Hm, it seems to return nil when you specify a count (even if you use 0) argument. I'm not sure why it's like that. Maybe matz or somebody else who has knowledge on this could answer... > Thanks again for your help. I am hoping I can get a proof-of-concept > replacement for dot.kde.org up some time in the distant future. If > it's successful, this would be another high profile site running on > Ruby. That would indeed be very nice. I'm looking forward to this. :) > Cheers, > Navin. Regards, Florian Gross