User guide

68
VTB USER GUIDE
err=disk.OpenRead(1,”\data\table.dat”) open table.dat in the directory data
if err
...
endif
while 1
err=disk.Read(1,dati(),10,nbyte()) ‘read blocks of 10 bytes ...
if err
...
endif
if nbyte<10 ‘ .. to the end of file
exitwhile
endif
loop
disk.Close(1) close the file
WRITE
Writes LEN bytes in the file with the HANDLE reference.
Syntax
.Write(handle as int, dati as *char, len as long, nb as *long) as char
Parameters
handle Reference number of the file
dati Pointer to data buffer to be written in the file
len Number of bytes to be written
nb Pointer to the variable in which the effective number of bytes written will be saved
Example
Used variables:
err char
dati(100) char
nbyte long
err=disk.OpenCreate(1,”\data\table.dat”) ‘create table.dat in the directory data
if err
...
endif
... ‘prepare data to be written
err=disk.Write(1,dati(),50,nbyte())‘write 50 bytes
if err
...
endif
disk.Close(1) close the file
SEEK, SEEKEOF, SEEKREL
Sets the current pointer in the file.
Syntax
.Seek(handle as int, offset as long) as char
Sets the offset from the beginning of the file.
.SeekEof(handle as int, offset as long) as char
Sets the offset from the end of the file.