From: "Wolfgang Nádasi-Donner" Date: 2007-11-10T00:57:14+09:00 Subject: Re: File 'rb' on non-Windows Jari Williamsson wrote: > To open binary files, on Windows the statement: > File.new("myfile", "rb") > is required. > > The docs just seem to say that the "b" is a Windows-only thing, not what > happens on other platforms. Will the "b" flag just be filtered out on > Linux/OS X? > > > Best regards, > > Jari Williamsson On Windows files will usually have line breaks build by the sequence "\r\n". When reading such a file in normal mode, the "\r" will be deleted and not inside the String. When writing data to a file, each "\n" will be replaced by "\r\n". When using "rb" or "wb" on Windows, the data will be unchanged. On Linux/OS X the line break character in a file is "\n", so the "b" mode doesn't have any effect. Wolfgang Nádasi-Donner -- Posted via http://www.ruby-forum.com/.