Re: problems / mistake in pack () and unpack() ???
| From: | Louis Solomon \[SteelBytes\] | Date: | Thu, 19 May 2005 01:08:04 +0000 |
| Subject: | Re: problems / mistake in pack () and unpack() ??? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-26029@lists.php.net to get a copy of this message | ||
if you wrote to the file from say a PowerPC (big endian) (eg MacOSX) using I
or L, then read the file using a Intel (or AMD) (little endian) (eg Windows)
using I or L, then it would give different results.
--
Louis Solomon
www.SteelBytes.com
"Burkhard Herre" <bherre@telematica.de> wrote in message
news:428B60C3.20706@telematica.de...
> hello
>
> i use the function pack() and unpack()
>
> i have following question:
>
>
> $content = -2147483647;
> $binarydata = pack("V", $content);
>
> ...(fwrite in file)
> ...(fread from file)
>
> $bin_str = fread ($handle, 4);
> $ascii_array = unpack("V", $bin_str);
> $ascii_str = $ascii_array[1];
>
> it makes no difference if i use the "V", the "l" or the "L" flag
!
>
> every flag works the same...output is '-2147483647'
>
> but from the php page i get this:
>
> l -- Long-Typ with sign (always 32 Bit, Byte-sequenz maschine depent)
>
> L -- Long-Typ without sign (always 32 Bit, Byte-sequenz maschine depent)
>
> V -- Long-Typ without sign (always 32 Bit, little endian)
>
>
> why is it so ?
> what happends ?
>
>
>
> thank you
>
>
>
>
>
>
>