Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
February 4, 2010, 9:46 am
rate this thread
How do I unpack a sequence of bytes to a signed short/long, with the
bitpattern being treated big endian? For unsigned shorts and longs, this is
no problem - you can indicate whether to use machine order, big endian or
little endian - but for signed there is no choice but to rely on machine
order, which happens to simply be wrong for files that follow a specifcation
in which all data types are in big or little endian order.
Re: how to unpack signed big endian shorts and longs (unpack() only supports unsigned)
Yea, PHP isn't great with binary data. When having to deal with a lot
of it, I'll use C/C++.
However, to solve your problem - I've never had to do it, but the data's
just a string. You should be able to reorder the characters in the
string, then unpack it.
Remove the "x" from my email address
JDS Computer Training Corp.