Mark Atwood (
fallenpegasus) wrote2008-11-21 12:53 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Dear Lazyweb, Perl unpack question
So I have a string that has a binary data structure in it, and I want to use Perl's unpack() on it
The binary structure is a 32bit int, followed by N 8 byte chunks. And I don't have quadwords in this build of Perl, so I cant treat them as 64bit ints.
And the following unpack string doesnt work: "L(a8)*".
What would the correct unpack string be?
The binary structure is a 32bit int, followed by N 8 byte chunks. And I don't have quadwords in this build of Perl, so I cant treat them as 64bit ints.
And the following unpack string doesnt work: "L(a8)*".
What would the correct unpack string be?
A shot in the semi-dark...
Reasoning: Looks like "a" signifies a null-terminated character string, so your expression would be "A long, followed by some number of groups of 8 null-terminated strings at a time". At the same time, c signifies a signed char (it doesn't sound like signed-ness makes a difference in this particular case), which is a byte, and you want an unknown number of groups of 8 bytes at a time.
Edited to add reasoning and fix the signed-ness of what c actually represents.
no subject
The Encode forces length to treat your strings as a collection of 8-bit bytes. The 'x' operator (yes, that's really a lower-case x, by the uncaring stars I hate Perl) in a string context causes multiplication of the string entity.
achat cialis 411
(Anonymous) 2013-07-13 06:13 pm (UTC)(link)