Re: fwrite int or float
| From: | Curt Zirzow | Date: | Fri, 25 Jul 2003 04:51:02 +0000 |
| Subject: | Re: fwrite int or float | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156788@lists.php.net to get a copy of this message | ||
* Thus wrote Ted Huntington (thunting@uci.edu):
> I basically solved this problem of writing a 32 bit float in little endian on
> a big endian computer using:
> $num2=pack("f",$num);
> fwrite($fp,$num2[3],1);
> fwrite($fp,$num2[2],1);
> fwrite($fp,$num2[1],1);
> fwrite($fp,$num2[0],1);
>
> for floating point (I am working on a UNIX [big endian] making a file for i86
> [little endian]).
>
> The more info, the better, perhaps some body else will search and find this
> if ever the need.
There was a large discussion on this about two weeks ago, check the
archives on 'big endian'
Curt
--
"I used to think I was indecisive, but now I'm not so sure."