Fast save of an area of memory to a file.
BSave a$, addr, count
a$:sexp; file name
addr, count:integer expression
An area of memory can be saved to disk (RAM disk, hard disk etc.) using BSave (block save) and loaded back in with BLoad (block load). The integer expression addr contains the start address of the memory to be saved. In addition, count must specify the length of the file a$.
OpenW # 1
Local addr%, count%, i%
Dim a%(999), b%(999)
For i% = 0 To 999
a%(i%) = Rand(1000)
Next i%
addr% = V:a%(0)
count% = (V:a%(1) - V:a%(0)) * 1000
BSave "C:\TEST.DAT", addr%, count%
addr% = V:b%(0)
count% = (V:b%(1) - V:b%(0)) * 1000
BLoad "C:\TEST.DAT", addr%
Kill "C:\TEST.DAT" // Tidy up line
For i% = 1 To 10
Print b%(600 + i%)
Next i%
The saving of files using BSave is - depending on the medium - 5 to 10 times faster than with Open...Print# ...Close. Even the memory needed by BSave is - depending on the file - up to three times smaller.
BSave and BLoad access files in a non-sharing mode.
{Created by Sjouke Hamstra; Last updated: 26/09/2014 by James Gaite}