Re: problems / mistake in pack () and unpack() ???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> wrote in message 
news:428B60C3.20706@xxxxxxxxxxxxxxxx
> 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
>
>
>
>
>
>
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux