From: Peter Hickman Date: 2005-11-03T20:13:51+09:00 Subject: Re: Detect if the computer is little or big endian Patrik Maunus wrote: > Hi! > > How can I know if my computer is little or big endian with Ruby? > I've searched the web but only got a few C/C++ solutions > > Perhaps pack a string into an integer and look at the result? Windows XPPro, Intel irb(main):002:0> [1,0,0,0].pack("i") => "\001\000\000\000" irb(main):003:0> Macintosh OS X, Power PC irb(main):004:0> [1,0,0,0].pack("i") => "\000\000\000\001" irb(main):005:0>