From: Eric Hodel Date: 2008-07-02T06:43:37+09:00 Subject: Re: Problem with unpack On Jul 1, 2008, at 13:32 PM, Rafael wrote: > I'm trying to read a binary file and would want to find within the > file a particular substring. I have done the following > > [...] unpack is useful when you need to turn binary data into usable structure. Just use a regular expression: open 'testfile', 'rb' do |io| if io.read(512) =~ /\020/ then puts "The tag was found" else puts "The tag was not found" end end