From: Martin DeMello Date: 2007-09-03T05:16:37+09:00 Subject: Re: force file write in dos format On 9/2/07, Xavier Noria wrote: > On Sep 1, 2007, at 1:16 PM, Martin DeMello wrote: > > > Is there any built-in way to force File.puts to use dos line endings, > > regardless of the platform under which the program is running? > > If I undertand correctly what you want your program is going to > explicitly output pairs "\r\n". > > If that's the case, in addition to the recommendation about IO#print > already given take into account that the io needs binmode. Otherwise, > on CRLF platforms you'd end up with "\r\r\n" on disk, which would be > wrong. That's because the single "\n" in "\r\n" gives itself a pair > "\r\n" in text mode. So IO#print CRLF in binmode is the complete > portable solution. Good point. As of now this will only ever be run on a linux box, but it certainly doesn't hurt to future-proof it. martin