Posted by CptDondo on 12/08/06 21:27
I am trying to pack a string. The data consists of an array of
integers, something like this:
e[1] 0x1234
e[2] 0x0001
e[3] 0x0002
What I want in my resulting packed $binrow is
0x1234 0x01 0x02
I've tried
pack("nCC",e[1],e[2],e[3])
but that packs it like this:
0x1234 0x00 0x31 0x00 0x32
which is most definitely not what I want.
How can I explicitly tell PHP that I want to cast an int as a char?
(Sorry if this is a FAQ somewhere, but I can't find it... This is
trivial to my C-trained mind but I can't see how to do it in PHP.)
--Yan
[Back to original message]
|