From: Alan Davies Date: 2003-05-21T01:33:22+09:00 Subject: Re: Bug in IO#write under windows I've fixed my truncate problems by using IO#pos instead, but this is a bug that needs to be adresssed surely? In article , NOSPAMcs96and@yahoo.co.ukNOSPAM says... > If you write line breaks to a file under windows, the write and syswrite > methods count a line break as one character, not two, meaning that the > value returned is incorrect. > > e.g... > > File.open('arr.txt', 'w') do |file| > arr = [ "123\n", "456" ] > puts file.write(arr) > end > > This bit of code displays the number 7 on the screen. The actual size > of the file is 8. This is causing me problems with File#truncate, > becuase I'm truncating too much of the file! >