From: Joel VanderWerf Date: 2006-01-17T06:51:00+09:00 Subject: Re: DANGER ! Ruby-Newbie ahead: How to access binary files ara.t.howard@noaa.gov wrote: > def bar > @mmap[@offset + Integer::SIZEOF, Float::SIZEOF].unpack("f").first > end > def bar= f > @mmap[@offset + Integer::SIZEOF, Float::SIZEOF] = > [Float(f)].pack("f") > end Doesn't this arithmetic assume that the C compiler is packing the fields of the struct? What if fields are aligned on 8 byte boundaries, for instance? I vaguely remember having some issues like this when porting from x86 to sparc. I guess you could add __attribute__((__packed__)) to the struct to be sure. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407