Maxima 5.46.0 Manual: Functions and Variables for binary input and output

Previous: Functions and Variables for plain-text input and output, Up: numericalio-pkg [Contents][Index]

### 76.3 Functions and Variables for binary input and output

Function: assume_external_byte_order (byte_order_flag)

  Tells `numericalio` the byte order for reading and writing binary data. Two values of byte_order_flag are recognized: `lsb` which indicates least-significant byte first, also called little-endian byte order; and `msb` which indicates most-significant byte first, also called big-endian byte order.

  If not specified, `numericalio` assumes the external byte order is most-significant byte first.

  Categories:Package numericalio ·

Function: openr_binary (file_name)

  Returns an input stream of 8-bit unsigned bytes to read the file named by file_name.

  See also `openw_binary` and `openr`.

  Categories:Package numericalio ·File input ·

Function: openw_binary (file_name)

  Returns an output stream of 8-bit unsigned bytes to write the file named by file_name.

  See also `openr_binary`, `opena_binary` and `openw`.

  Categories:Package numericalio ·File output ·

Function: opena_binary (file_name)

  Returns an output stream of 8-bit unsigned bytes to append the file named by file_name.

  Categories:Package numericalio ·File output ·

Function: read_binary_matrix (S, M)

  Reads binary 8-byte floating point numbers from the source S into the matrix M until M is full, or the source is exhausted. Elements of M are read in row-major order.

  The source S may be a file name or a stream.

  The byte order in elements of the source is specified by `assume_external_byte_order`.

  See also `read_matrix`.

  Categories:Package numericalio ·File input ·

Function: read_binary_array (S, A)

  Reads binary 8-byte floating point numbers from the source S into the array A until A is full, or the source is exhausted. A must be an array created by `array` or `make_array`. Elements of A are read in row-major order.

  The source S may be a file name or a stream.

  The byte order in elements of the source is specified by `assume_external_byte_order`.

  See also `read_array`.

  Categories:Package numericalio ·File input ·

Function: read_binary_list
`read_binary_list` (S)
`read_binary_list` (S, L)

  `read_binary_list(S)` reads the entire content of the source S as a sequence of binary 8-byte floating point numbers, and returns it as a list. The source S may be a file name or a stream.

  `read_binary_list(S, L)` reads 8-byte binary floating point numbers from the source S until the list L is full, or the source is exhausted.

  The byte order in elements of the source is specified by `assume_external_byte_order`.

  See also `read_list`.

  Categories:Package numericalio ·File input ·

Function: write_binary_data (X, D)

  Writes the object X, comprising binary 8-byte IEEE 754 floating-point numbers, to the destination D. Other kinds of numbers are coerced to 8-byte floats. `write_binary_data` cannot write non-numeric data.

  The object X may be a list, a nested list, a matrix, or an array created by `array` or `make_array`; X cannot be a hashed array or any other type of object. `write_binary_data` writes nested lists, matrices, and arrays in row-major order.

  The destination D may be a file name or a stream. When the destination is a file name, the global variable `file_output_append` governs whether the output file is appended or truncated. When the destination is a stream, no special action is taken by `write_binary_data` after all the data are written; in particular, the stream remains open.

  The byte order in elements of the destination is specified by `assume_external_byte_order`.

  See also `write_data`.

  Categories:Package numericalio ·File output ·

Previous: Functions and Variables for plain-text input and output, Up: numericalio-pkg [Contents][Index]