BinaryRead

BinaryRead[stream]
reads one byte of raw binary data from an input stream, and returns an integer from 0 to 255.

BinaryRead[stream,type]
reads an object of the specified type.

BinaryRead[stream,{type1,type2,}]
reads a sequence of objects of the specified types.

Details and OptionsDetails and Options

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Create a file with a sequence of bytes:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input

Read the first byte from the file:

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

Read the second byte as an 8-bit character:

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

Read the next byte as an 8-bit signed integer:

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

Close the file:

In[7]:=
Click for copyable input
Out[7]=
Introduced in 2004
(5.1)
| Updated in 2007
(6.0)