background image
Original Author Paul Laughton, 2011
Page 116
De Re BASIC!
Zip.count <path_sexp>, <nvar>
Returns the number of entries inside the ZIP file located at <path_sexp>. The path is relative to "<pref
base drive>/rfo-basic/data/".
The count is returned in the <nvar>. If the ZIP file does not exist, the returned count is 0.
Zip.dir <path_sexp>, Array$[] {,<dirmark_sexp>}
Returns the names of the files and directories inside the ZIP file located at <path_sexp>. The path is
relative to "<pref base drive>/rfo-basic/data/".
The names are placed into Array$[]. The array is sorted alphabetically with the directories at the top of
the list. If the array exists, it is overwritten, otherwise a new array is created. The result is always a one-
dimensional array.
A directory is identified by a marker appended to its name. The default marker is the string "(d)". You
can change the marker with the optional directory mark parameter <dirmark_sexp>. If you do not want
directories to be marked, set <dirmark_sexp> to an empty string, "".
Zip.open {r|w|a}, <file_table_nvar>, <path_sexp>
The ZIP file specified by the path string expression <path_sexp> is opened. The path is relative to "<pref
base drive>/rfo-basic/data/".
The first parameter is a single character that sets the I/O mode for this file:
Parameter
Mode
Notes
r
read
File exists: Reads from the start of the file.
File does not exist: Error (see below).
w
write
File exists: Writes from the start of the file. Writes over any existing data.
File does not exist: Creates a new file. Writes from the start of the file.
Note: unlike Text.open and Byte.open, Zip.open does not support append mode.
A file table number is placed into the numeric variable <file_table_nvar>. This value is for use in
subsequent Zip.read, Zip.write, or Zip.close commands.
If there was an error opening the ZIP file, <file_table_nvar> is set to -1 with details available from the
GETERROR$() function.
Zip.close <file_table_nexp>
Closes the previously opened ZIP file.
Zip.read <file_table_nexp> ,<buffer_svar>, <file_name_sexp>
Reads the content of the file <file_name_sexp> from inside a ZIP file and puts the result byte(s) inside
the buffer string variable <buffer_svar>.