From: Erik Veenstra Date: 2005-06-23T05:40:38+09:00 Subject: Too many CR's on Windows If I run these scripts on Linux (replacing "dir" with "ls -l") the outputs are what I expect. Both scripts print 5 and show a file size of 5. But when I run them on Windows... Surprise, surprise... The file sizes become 6! A hex editor tells me that there are 2 CR's: 61 62 63 0D 0D 0A. Why? I'm a little bit confused now... gegroet, Erik V. - http://www.erikveen.dds.nl/ ---------------------------------------------------------------- # Test with PUTS File.open("test.txt", "w") do |f| f.puts "abc\r\n" end File.open("test.txt", "r") do |f| puts f.read.length end system "dir test.txt" ---------------------------------------------------------------- # Test with WRITE File.open("test.txt", "w") do |f| f.write "abc\r\n" end File.open("test.txt", "r") do |f| puts f.read.length end system "dir test.txt" ----------------------------------------------------------------