Reading binary files (or strings)

Han Holl han@pobox.com writes:

string.unpack(“@#{offset}format”)

Yes! That’s exactly what I need. Thanks.
This was neither in the online Ruby book, nor in the String.html in the
official docs.

Umm… it’s the last entry in the table
(http://www.rubycentral.com/book/ref_c_string.html#String.unpack)

  :         :                      :                       :
> @  | Skip to the offset given by the length argument. |     |
  :         :                      :                       :

Regards

Dave

Dave Thomas wrote:

Han Holl han@pobox.com writes:

string.unpack(“@#{offset}format”)

Yes! That’s exactly what I need. Thanks.
This was neither in the online Ruby book, nor in the String.html in the
official docs.

Umm… it’s the last entry in the table

Oops. Yes, I completely missed it, even after Nobu told me what to
look for ! I’ll stop making lame excuses.

And thanks a lot for that book!

Han