Question: reading an empty file results in nil

anEmptyFile.read results in nil:

test.rb:

p RUBY_PLATFORM
p RUBY_VERSION

File.open( "test.txt", "w" ) do |f|
    f.write ""
end

File.open( "test.txt", "r" ) do |f|
    p f.read
end

output:

% ruby test.rb
"i386-mswin32"
"1.7.2"
nil

Is this new behavior? I’m using the prag installer windows.

~ Patrick May

Hi,

···

In message “question: reading an empty file results in nil” on 03/02/01, Patrick May patrick-may@monmouth.com writes:

anEmptyFile.read results in nil:

Fixed in the latest.

						matz.

Matz,

anEmptyFile.read results in nil:

Fixed in the latest.

Thanks for the fix and the rapid response.

~ Patrick