One little endian question
Kenneth Brody
kenbrody at bestweb.net
Mon Mar 3 10:35:57 PST 2008
Quoting Brian K. White (Mon, 3 Mar 2008 13:19:37 -0500):
[...]
> ---snip---
> It's easy enough to write code to check if you are big or little
> endian. The following function returns true if we are big endian.
> int am_big_endian()
> {
> long one= 1;
> return !(*((char *)(&one)));
> }
> ---snip---
>
> ie: write the value "1" into a long, then read back only a char. If
> you get a 1 you are big-endian. If you get a 0 you are little endian.
Well, it doesn't work for middle-endian systems, but since filePro doesn't
run on any such system, the point is moot.
[...]
> Laura's trick fills the bill, it just requires an external file to
> exist along with the processing and assumes that file is correctly
> formatted for the platform the code is running on.
If you're in *clerk, you have a screen. If you're in *report, you have
an output format (unless you're running with "-fp"). Both are guaranteed
to be in the correct byte order.
[...]
--
KenBrody at BestWeb dot net spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com
More information about the Filepro-list
mailing list