Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
BINREAD Statement
BINREAD(integer-handle, integer-buffer, integer-length)

Reads binary data from an open file into memory.

  • integer-handle — file handle from OPENIN or OPENUP.
  • integer-buffer — destination memory handle/pointer (from MEMALLOC).
  • integer-length — number of bytes to read.

Examples

fh = OPENIN("asset.bin")
size = FILESIZE("asset.bin")
buf = MEMALLOC(size)
BINREAD fh, buf, size
REM ... use buffer ...
MEMRELEASE buf
CLOSE fh

Notes

  • Use FILESIZE to size your buffer appropriately.
  • Binary-safe (no line translation).
  • Reading past end of file yields fewer bytes or an error, depending on context; check with EOF as needed.

See also: OPENIN · OPENUP · FILESIZE · EOF · MEMALLOC