read binary data from a file
Read(file, type, num, opt1, opt2, ...)
file descriptor or filename
type of data to read
number of elements to read
byteorder = opt
(optional) byte order specification
output = identical(list,Vector,Array)
(optional) output format
The Read(file, type, num) command reads num elements in type format from a file and returns them in the form of a list.
The following are valid values for type: integer, integer, integer, integer, float, float. These types represent hardware data types. The integer[n] is an n byte integer, and float[n] is an n byte float.
The byteorder argument can have one of four values: big, little, network, and native. This effects the order in which bytes are written for multi-byte data types.
- big and little specify big endian and little endian respectively
- network specifies network ordering (big endian)
- native uses the native byte ordering
If byteorder is not specified, it defaults to network.
The output argument lets you specify the return-value data structure used to store the binary data. Using output=Array or output=Vector can be more efficient as these data structures will keep the data in the specified hardware format without requiring any conversion. The default is output = list in order to be compatible with previous versions of Maple.
If file is the name of a file that has not been opened, Maple attempts to open the file before attempting to read the data.
An error is raised if file is not a valid descriptor or if it is the name of a file that does not exists.
num ≔ 1⁢2563+2⁢2562+3⋅256+4
num ≔ 1690960
num2 ≔ 4⁢2563+3⁢2562+2⋅256+1
num2 ≔ 67305985
The FileTools[Binary][Read] command was updated in Maple 2016.
The output parameter was updated in Maple 2016.
Download Help Document
What kind of issue would you like to report? (Optional)
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.