From: Tom Felker Date: 2003-05-21T05:42:44+09:00 Subject: Re: Bug in IO#write under windows On Tue, 2003-05-20 at 11:33, Alan Davies wrote: > I've fixed my truncate problems by using IO#pos instead, but this is a > bug that needs to be adresssed surely? By all means, but it's a bug in Windows, not Ruby. Printers require both \r and \n to go to a new line. DOS decided that instead of converting output to the printer, text files should be stored with \r\n, but when read or written to, these should be converted to \n. Naturally, this braindead design screws up the file position. Linux doesn't do this at all, and Macs only use \r, IIRC. To get around this, open the file in binary mode (by including b in the mode string). Note that you will then need to give text files a \r\n separator, or Notepad will barf. (Wordpad can handle normal files, though.) -- Tom Felker Verbing weirds language. -- Calvin, Bill Watterson