On 13.06.2007 15:28, F. Senault wrote:
> Le 13 juin 15:20, Alex Young a ˝─rit :
> 
>> Damjan Rems wrote:
> 
>>> Is this a bug or am I missing something?
>> Try File.new('att.tif','wb+').write(att).  From memory, the 'b' in 'wb+' 
>> turns off newline conversion.
> 
> Yep.  From the PickAxe :
> 
> Mode   Meaning
> r      Read-only, starts at beginning of file (default mode).
> r+     Read/write, starts at beginning of file.
> w      Write-only, truncates an existing file to zero length or creates 
>          a new file for writing.
> w+     Read/write, truncates existing file to zero length or creates a 
>          new file for reading and writing.
> a      Write-only, starts at end of file if file exists ; otherwise 
>          creates a new file for writing.
> a+     Read/write, starts at end of file if file exists ; otherwise 
>          creates a new file for reading and writing.
> b      (DOS/Windows only) Binary file mode (may appear with any of the 
>          key letters listed above).
> 
> I'd add that b has no effect whatsoever on other OSes.  (In other words,
> you may leave "wb+" and stay platform independent.)

That's what I would do for binary files.  It also helps documenting.

Kind regards

	robert