# Reading binary files (or strings)

**URL:** <https://rubytalk.org/t/reading-binary-files-or-strings/22>\
**Category:** ruby-talk\
**Created:** [1 June 2002 14:55 UTC](https://rubytalk.org/t/reading-binary-files-or-strings/22 "2002-06-01T14:55:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Thomas](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@Dave\_Thomas](https://rubytalk.org/u/Dave_Thomas)\
**Post date:** [1 June 2002 14:55 UTC](https://rubytalk.org/t/reading-binary-files-or-strings/22/1 "2002-06-01T14:55:12Z")

</div>

Han Holl [han@pobox.com](mailto: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](http://www.rubycentral.com/book/ref_c_string.html#String.unpack))

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

```

Regards

Dave

---

<div class="post-metadata">

**Author:** ![Han\_Holl4](https://avatars.discourse-cdn.com/v4/letter/h/d2c977/32.png) [@Han\_Holl4](https://rubytalk.org/u/Han_Holl4)\
**Post date:** [1 June 2002 15:13 UTC](https://rubytalk.org/t/reading-binary-files-or-strings/22/2 "2002-06-01T15:13:39Z")

</div>

Dave Thomas wrote:

> Han Holl [han@pobox.com](mailto: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
