This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ByteOrdering

ByteOrdering
is an option for BinaryRead, BinaryWrite, and related functions that specifies what ordering of bytes should be assumed for your computer system.
  • corresponds to big endian (appropriate for PowerPC 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.
$ByteOrdering gives the byte ordering on this machine:
Create a file with a 32-bit integer:
Read the data from the file:
Read the data with reverse byte ordering:
Recreate the correct interpretation using Mathematica functions:
$ByteOrdering gives the byte ordering on this machine:
In[1]:=
Click for copyable input
Out[1]=
 
Create a file with a 32-bit integer:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Read the data from the file:
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Read the data with reverse byte ordering:
In[6]:=
Click for copyable input
Out[6]=
Recreate the correct interpretation using Mathematica functions:
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=
In[9]:=
Click for copyable input
New in 5.2