pack and unpack problems.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Are there any gurus of the pack/unpack world out there that can help me
with this one?

I have an encrypted string which I'm reading from a zipped file. It was
written using

pack ( "la" . strlen (encrypted), strlen (encrypted), strlen (encrypted))

most of the time, it decrypts correctly when I unpack as...

list (, $Len ) = unpack ("l", gzread($ZipFile, 4));
$temp = unpack ( "C".$Len, gzread($ZipFile, $Len));

...except when it doesn't. I have no control over the format of the file,
so can't change that. My gut feeling is that the problems are caused by
the 'a' flag used to write it, which may be adding nulls to the string.

Anyone got any ideas what I'm doing wrong??

Cheers, Steve

Site Timeline