Austin Ziegler
1/16/2006 4:49:00 PM
On 16/01/06, Meino Christian Cramer <Meino.Cramer@gmx.de> wrote:
> There is a file on my HD, which was written by a C program. The C
> program wrotes the contents of an array of structures (each array
> element was made from the same structure) to that file.
>
> Since accessing that file looks like a very low level and
> "procedure-based" thing to me I would be very interested how this job
> can be done in a most ruby-like, objectoriented way.
If you're using Windows, make sure you open the file in binary mode:
File.open(filename, "rb") ...
Otherwise, look up Array#unpack. There are examples of this in the
ImageInfo library that is on the RAA; I have a custom copy of it in
PDF::Writer.
-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca