$ByteOrdering

$ByteOrdering
gives the native ordering of bytes in binary data on your computer system.

DetailsDetails

  • Possible values of $ByteOrdering are and .
  • corresponds to big endian (appropriate for 680x0 and many other processors); corresponds to little endian (appropriate for x86 processors).
  • corresponds to having the most significant byte first; to having the least significant byte first.
  • is the order obtained from IntegerDigits[n, 256].
  • $ByteOrdering gives the default setting for the ByteOrdering option in Import and Export.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Byte ordering on this machine:

In[1]:=
Click for copyable input
Out[1]=

Read in a byte stream with reversed byte ordering:

In[1]:=
Click for copyable input
Out[1]=

Correct the byte ordering:

In[2]:=
Click for copyable input
Out[2]=
New in 4
New to Mathematica? Find your learning path »
Have a question? Ask support »