endians

Bill Campbell bill at celestial.com
Mon Nov 28 15:34:52 PST 2005


On Mon, Nov 28, 2005, Kenneth Brody wrote:
>Quoting Dennis Malen (Mon, 28 Nov 2005 16:58:43 -0500):
>
>> Jim,
>>
>> I ran it as a shell script. I don't have a C Compiler on the RISC box.
>[...]
>
>It's a C program, not a shell script.  The lack of a C compiler does
>not imply that C source code can be run as a shell script instead.
>
>If it's a RISC box, with the same CPU series as the RS/6000's RISC
>processor, then it's big-endian.

An easy way to determine the endianness of a machine that has a
reasonably current version of python is with a script like this:

#!/usr/bin/env python
import sys
print sys.byteorder

Perl has something similar, but less intuitive as it seems backwards
for little endian machines:

You can get this from the command line with ``perl -V:byteorder``
which returns byteorder='1234'; on a little-endian machine.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

Once at a social gathering, Gladstone said to Disraeli, ``I predict,
Sir, that you will die either by hanging or of some vile disease''.
Disraeli replied, "That all depends upon whether I embrace your
principles or your mistress".


More information about the Filepro-list mailing list