From: Robert Klemme Date: 2008-02-27T17:04:56+09:00 Subject: Re: extracting hex keys from file On 27.02.2008 05:08, Ben Aroia wrote: > Hello. I have a file that contains several values that I would like to > read in as hex values (e.x. 3F 5A 6B 43 0E 2F AE...) I have some partial > code: > > def getHash(file_in) > f = File.new(file_in, "r") > f.each_byte {|x| print x.to_s+"\n"} > #need something here > end > > I would like to extract the hex values from a known offset for a > specific length, and I'm quite sure I can do that by accelorating the > pointer a bit with a simple for loop. I come from a Java background and > new to ruby so any help would be great. Thanks http://www.ruby-doc.org/core/classes/IO.html#M002305 robert