From: Robert Date: 2002-12-30T22:39:32+09:00 Subject: Re: WARN: mswin32 build binary file read change of behavior "Milan Maksimovic" schrieb im Newsbeitrag news:002101c2afd7$4faa8580$abd8ecd8@tao... > I'd say that reading a bunch of bytes without caring what they are is > basic and common functionality. of course! > My daytime job mostly consists of doing Windows C++ and Java programming > (and attempts to to introduce some Ruby along the way, where > possible/appropriate). > > On Windows, using native Win32 API, I can (and do) open a file, read a > bunch of bytes (or all of them), and write that to some other file/buffer as > it is, with no fuss and without ever wondering if something happened with > those bytes in the meantime. Ok, I have to set up some silly flags that > don't mean much most of the time, but none of them relate to binary/text > properies of the file. > > In Java, I open a plain FileInputStream, and read all the byte[] that I > need, manipulate them and write them to some other OutputStream without ever > thinking about LF/CRLF conversion. to me it seems the appropriate way to do it in ruby is to use the flag "b" as others already indicated. as you write yourself, on other platforms / languages you distinguish explicitely between binaray and text access to files (well done in java, apart from the PrintOutputStream) by either using a different class or providing some flags. so the proper way to do it is to use the distiguishing means that ruby provides. all i'm trying to say is, there is a difference between text based file access and binary file access although some languages and platforms do make it unclear. thus, i regard opening a binary file in ruby without "b" a mistake although this may work on some platforms. kind regards robert