[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Counting records in a binary file
- From: "Javier Guerra" <javier@...>
- Date: Mon, 15 Sep 2008 10:42:43 -0500
On Mon, Sep 15, 2008 at 10:07 AM, Jeff Wise <email@example.com> wrote:
> ➢ ignore it, and don't waste time trying to use it
> I must count the records. Each record begins with '5A'. After this '5A' is a 2 byte length but it does not account for the '5A'. Unfortunately "gsub" will not count the records because there are '5A' embedded. Here is an example of the form '5A', nnnn, data bytes.
if you're not interested in the records content, then just:
- read three bytes
- assert the first is a '5A' (optional, just for checks)
- convert bytes 2,3 to a number 'N'
- skip N bytes