binfile

Top  Previous  Next

binfile

fl=new("binfile"[,filename$])

 

The binfile object provides read/write access to the file in binary fashion, where there is no concept of a record.  All access is to specific byte positions in the file, or the file as a whole.  The filename$ argument specifies what file to open or create.  If no file name is supplied, then a temporary file will be created. This temporary file will be erased when the UnForm job is complete.

 

Properties

filename$ is a read-only property that contains the full path to the file name opened or created.

size contains the file size in bytes.  If size is assigned, the file is expanded or truncated to the specified size.

 

Methods

append(block$) appends block$ to the end of the file, and returns the size of the file.

delblock(index,length) removes the specific bytes from the file, and returns the size of the file.

getblock$(index,length) returns file content at the specified position and length.  The position is 1-based, so the first byte is 1.

getfile$() returns the entire contents of the file.

insblock(index,block$) inserts block$ in the file at the 1-based index position.  Returns the size of the file.

purge() sets the file length to 0, just like setting the size property to 0.

putblock(index,block$) writes block$ to the file at the 1-based index position, replacing data at that position.  Returns the size of the file.

putfile(block$) updates the file contents to block$, truncating or expanding as necessary.  Returns the size of the file.