WRITE DIRBLOCK to READ FILEBLOCK by Naphier14th Nov 2011 23:26
|
---|
Summary This code illustrates how to extract a single file (FILEBLOCK) from a package created with WRITE DIRBLOCK. This can be modified so that you can extract a single file (essentially Description This allows us to see the structure of a DIRBLOCK package and allows a way to read filenames out of the package without actually knowing them before hand. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com open to read 1,"backup.pak" read byte 1,c // # of files contained in backup.pak read byte 1,d read byte 1,d read byte 1,d //cannot do this as a single data type, unfortunately for n = 1 to c if file exist("filename.txt") delete file "filename.txt" endif read fileblock 1,"filename.txt" open to read 2, "filename.txt" read string 2, filename$ close file 2 delete file "filename.txt" read fileblock 1,filename$ next n close file 1 print "Extraction complete." wait key : end |