FREAD

Purpose: Reads data from a binary file.

Formats:  1)    FREAD    ID    variable    type    <byte ordering>
                   2)    FREAD    ID    $variable    size
                   3)    FREAD    ID    memory(x)    size    type    <byte ordering>
 

Notes:  These statements will read data from a file in the form designated by the type  parameter and place the value in the  variable  parameter.  The  byte ordering  parameter is  B  for big endian,  L  for little endian (default)  and is optional.

Form 1:  A single value is read from the file and placed into  variable.

Form 2:  Use this to read  size  characters from the file and place them in to the  $variable  text string.

Form 3:  Reads  size  values from the file into the memory array starting at the location specified by  x.  Precision may be lost when specifying 32 bit integers and 64 bit floating point types.
 

Binary File Numeric Types
Type Description Bits Range
f64 Double Floating Point  64 3.4E-308 to 3.4E+308  (15 digit precision)
f32 Floating Point 32 1.7E-38 to 1.7E+38  (7 digit precision)
u32 Unsigned Long Integer  32 0 to 4,294,967,295
s32 Signed Long Integer 32 -2,147,483,648 to +2,147,483,647
u16 Unsigned Short Integer 16 0 to 65,535
s16 Signed Short Integer 16 -32,768 to +32,767
u8 Unsigned Byte  8 0 to 255
s8 Signed Byte   8 -128 to +127

See Also:  Binary File Operations