Overview
The BinaryFile library includes many methods for working with binary files.
Before using these methods you need to first add a reference to BinaryFile.dll and then
create an object of this type.
Afterwards, initialize the object using New1.
The BinaryFile object receives a file connection (Stream) of a randomly opened file.
The methods include writing and reading different types of data from a file.
After reading or writing a value from the file, the file pointer moves forward to the next
value.
Methods for setting the absolute or relative position of the file pointer (next byte to read).
And method for embedding and retrieving files to a file.
Example:
'First add an object named bin (of BinaryFile type).
Sub Globals
End Sub
Sub App_Start
FileOpen(c1,"data.dat",cRandom)
bin.New1(c1,true)
bin.WriteString ("Product1")
bin.WriteDouble(123.23)
bin.WriteInt16(5)
bin.Position = 0 'Return the pointer to the start
productName = bin.ReadString
price = bin.ReadDouble 'Types must match
count = bin.ReadInt16
msgbox("Product: " & productName & crlf & "Price:
" & price & crlf
& "Amount: " & count)
FileClose(c1)
End Sub