Fast read of files saved with Bput.
Bget #n, addr, count
n, addr, count:integer expression
Bget (block get) is used to read files stored with Bput (block put). A channel for the file must be opened first with Open. addr contains the address where in memory the file should be loaded. count defines how much data should Bget read from the file.
' Save and Load an array
OpenW # 1
Dim a%(999), addr%, b%(200), count%, i%
For i% = 0 To 999
a%(i%) = Rand(1000)
Next i%
addr% = V:a%(0)
count% = (V:a%(1) - V:a%(0)) * 1000
Open "C:\TEST.DAT" for Output As # 1
BPut # 1, addr%, count%
Close # 1
Open "C:\TEST.DAT" for Input As # 1
addr% = V:b%(0)
count% = (V:b%(1) - V:b%(0)) * 200
BGet # 1, addr%, count%
Close # 1
Kill "c:\TEST.DAT"
For i% = 1 To 10
Print b%(i%)
Next i%
Reads the first 200 values from the file TEST.DAT on drive C from the address V: b%(0) into array b%().
Bget and Bput can also be used to save and read parts of a file.
{Created by Sjouke Hamstra; Last updated: 26/09/2014 by James Gaite}