lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, Sep 15, 2008 at 10:07 AM, Jeff Wise <> 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
- repeat