Re[2]: [PHP] BigEndian to integer
| From: | Tom Rogers | Date: | Tue, 15 Jul 2003 12:04:39 +0000 |
| Subject: | Re[2]: [PHP] BigEndian to integer | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155268@lists.php.net to get a copy of this message | ||
Hi,
Tuesday, July 15, 2003, 7:00:33 PM, you wrote:
>> > http://www.php.net/pack
>>
>> A little background on what Im doing. Im attempting to read realaudio
>> files for their metadata, so Im reading from a binary string,
>> and Im currently using unpack() (Im new to using this function, so I may
>> be wrong with its usage) to unpack the data, along with ord(),
>> and the result is something like what I posted before -> 0 0 0 18 (I
>> put the spaces in there so we know that each number is a byte)
>> So Im not exactly sure how the pack() function would play a role in this.
JR> Just in case you're still groggy when you wake up this morning, the page
JR> for pack() lists an 'N' format for unsigned long big endian byte order
JR> for pack() and unpack(). I think what you probably want to do most is
JR> use the 'N' format when you unpack.
JR> (The other responses were amusing, was it a full moon last night? ;-))
JR> --
JR> Joel Rees, permanently jetlagged programmer, Kansai Systems Group
JR> Altech Corporation (Alpsgiken), Osaka, Japan
JR> http://www.alpsgiken.co.jp
Trying to use unpack by itself on large binary streams with variable packet
sizes and content buried in them can become a nightmare. Try to
unscramble an excel file using unpack() :)
--
regards,
Tom