in reply to Re: reading packed unsigned long long
in thread reading packed unsigned long long

I found out a little bit more about that HEX representation: ..turns out that the last two fields are six bytes and eight bytes (00000000004a/000000000000004a) equalling a decimal 74. I guess I really need to know the correct combination of format characters (e.g., 'NNCNN' - I've tried the "Q" option which my system rejects)....
  • Comment on Re^2: reading packed unsigned long long

Replies are listed 'Best First'.
Re^3: reading packed unsigned long long
by ikegami (Patriarch) on Jul 15, 2009 at 14:45 UTC

    Rejected how? "Invalid type 'Q' in unpack"? Note the comment at the bottom of my previous post. Your Perl can't handle 64-bit numbers because your processor can't handle them natively. You could build a Perl that supports 64-bit numbers (even if your processor doesn't handle them natively), or you could use Math::BigInt to hold such a big number. I'll even code the solution if you tell me which byte ordering you want to use.

    turns out that the last two fields are six bytes and eight bytes

    There's no unpack specifier for reading 6-byte ints. j and J might be 6-bytes on your machine, but I'd be surprised. Nobody uses 6-byte ints. That's part of why I said your data is messed up.

    You expect To get that What you have ---------------- ---------------- ---------------- 0 0000000000000000 5967* 000000000000174f 000000000000174f 74 000000000000004a 0100000000004a 74 000000000000004a 000000000000004a

    * — You actually said 5976. I presume that's a typo.

      Hi - ..I get "Invalid type in unpack: 'Q'" ..you're right, "J" & "j" don't cut it either... ...thanks for the offer, what's the standard byte order? I also want to look into "Math::BigInt" - I've never heard of this: is it a library of Perl functions?

        what's the standard byte order?

        There isn't one.

        You're either using your local machine's byte order (which happens to be big-endian) or you're using big-endian explicitly.

        The question was whether you want to use the local machine's byte order (whatever it might be) or to use big-endian explicitly.

        I also want to look into "Math::BigInt" - I've never heard of this: is it a library of Perl functions?

        Math::BigInt