Hi,
Just wondering if Linux has a command or something we can use to check if it
uses Little-Endian or Big-Endian. This is an embedded Linux running on
MIPS.
Thanks,
TJ
--
|
|
0
|
|
|
|
Reply
|
l_x2828 (152)
|
7/24/2006 4:50:41 PM |
|
On Mon, 24 Jul 2006 11:50:41 -0500, TJ wrote:
> Hi,
>
> Just wondering if Linux has a command or something we can use to check if it
> uses Little-Endian or Big-Endian. This is an embedded Linux running on
> MIPS.
#include <stdio.h>
#include <arpa/inet.h>
int main() {
if (htons(1) == 1) puts("big endian");
else puts("little endian");
return 0;
}
Works on any *nix ;-)
Greetings,
Aaron
--
Aaron Isotton | http://www.isotton.com/
Black holes are where God divided by zero. -- Steven Wright
|
|
0
|
|
|
|
Reply
|
aaron7297 (11)
|
7/30/2006 3:54:18 PM
|
|