Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail From: 7stud -- Newsgroups: comp.lang.ruby Subject: Re: Binary file: SAT Date: Wed, 20 Apr 2011 19:45:44 -0500 Organization: Service de news de lacave.net Lines: 19 Message-ID: References: <4fa8adc3b92c44287a399f6cb1aab3ff@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1303346768 62769 65.111.164.187 (21 Apr 2011 00:46:08 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Thu, 21 Apr 2011 00:46:08 +0000 (UTC) In-Reply-To: <4fa8adc3b92c44287a399f6cb1aab3ff@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381965 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:3281 7stud -- wrote in post #994163: > > Once you are familiar with what each byte in your file represents, you > can use String#unpack to tell ruby how many bytes each integer occupies, > and how to interpret the integer. But, I can't get a simple unpack() example to work, so what do I know: str = "\x00\x00\x00\x61" #97 in hex, taking up 4 bytes results = str.unpack("L") p results --output:-- [1627389952] -- Posted via http://www.ruby-forum.com/.