Original Author Paul Laughton, 2011
Page 115
De Re BASIC!
This command can only be used on files open for byte read.
Byte.position.mark {{<file_table_nexp>}{, <marklimit_nexp>}}
Marks the current position in the file, and sets the mark limit to <marklimit_nexp> bytes.
Both parameters are optional. If the file table index <file_table_nexp> is omitted, the default file is the
last file opened; you must ensure that the last file opened was a Byte file opened for reading. If the
mark limit <marklimit_exp> is omitted, the default value is the file's current mark limit.
Please read Working with Files
Mark and Mark Limit, above.
Byte.truncate <file_table_nexp>,<length_nexp>
Truncates the file to <length_nexp> bytes and closes the file. Setting the truncate length <length_nexp>
larger than the current length (current write position - 1) has no effect.
This command can only be used on files open for byte write or append.
Byte.copy <file_table_nexp>,<output_file_sexp>
Copies the previously open input file represented by <file_table_nexp> to the file whose path is
specified by <output_file_sexp>. The default path is "<pref base drive>/rfo-basic/data/".
If <file_table_nexp> = -1 then a run-time error will be thrown.
All bytes from the current position of the input file to its end are copied to the to the output file. Both
files are then closed.
If you have read from the input file, and you want to copy the whole file, you must reset the file position
to 0 with Byte.position.set. However, if you have changed the file mark with Byte.position.mark, or if
you reading a non-local (internet) file, you can't reset the file position to 0. Instead, you must close and
reopen the file.
You should use Byte.copy if you are using Byte I/O for the sole purpose of copying. It is thousands
(literally) of times faster than using Byte.read/Byte.write.
ZIP File I/O
The ZIP file I/O commands work with compressed files. ZIP is an archive file format that stores multiple
directories and files, using a method of lossless data compression to save file space.
Use Zip.dir to get an array containing the names of all of the directories and files in an archive. Use the
file names with Zip.read to extract files from the archive. Zip.read can not extract a directory. Use
Zip.write to put files in a new archive. You can overwrite an existing ZIP file, but you cannot replace or
add entries.