Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference

read-int


Type:   -   function (subr)
Source:   -   xlfio.c

Syntax

(read-int [stream [length]])
stream - the input stream [default is standard input]
length - the length of the integer in bytes [default is 4]
returns - the integer

Description

The 'read-int' function reads an integer from a binary input stream, created by the open-binary function.

Note: Integers and floats are assumed to be big-endian [high-order byte first] and signed, regardless of the platform. To read little-endian format, use a negative number for the length, e.g. '-4' indicates a 4-bytes, low-order byte first. The file should be opened in binary mode.

Examples


See also write-int, read-float, write-float, bigendianp, open-binary.

  Back to Top


Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference