[Win32utils-devel] IO.read questions

Daniel Berger djberg96 at gmail.com
Thu May 3 00:48:54 UTC 2012


Hi,

ruby 1.9.3p125 (both mingw and mswin)

Is this a bug? I've got a file, test.txt, that contains nothing but this:

This is line 1
This is line 2
This is line 3

I ran these snippets of code:

IO.read('test.txt')          # => "This is line 1\nThis is line
2\nThis is line 3\n"
IO.read('test.txt', nil)     # => "This is line 1\nThis is line
2\nThis is line 3\n"
IO.read('test.txt', nil, 0) # => "This is line 1\r\nThis is line
2\r\nThis is line 3\r\n"

Why are the native line endings retained if I specify an offset? Ruby
1.8.x doesn't do that, btw.

Regards,

Dan


More information about the win32utils-devel mailing list