Bug TrackerDocumentationMain Site
docs.sodaware.net

Documentation Area -- Product and developer resource manuals.

Chapter 2. Extracting a file from a ZIP

How to extract a file from a ZIP.

[Download example source.]

Example 2.1. Extracting a file from a ZIP.

; --------------------------------------------------
; --
; -- examples/example2.bb
; --
; -- How to open a zip file an extract a file from
; -- it.
; --
; --------------------------------------------------
 
; Include required libraries
Include "../Blitz_Basic_Bank.bb"
Include "../Blitz_File_FileName.bb"
Include "../Blitz_File_ZipApi.bb"
 
; Open the zip file for reading
Local zipIn = ZipApi_Open("example.zip")
 
; Check the zip file was valid
If zipIn = 0 Then
	; Not a valid ZIP file - display error and exit program
	Print "There was an error whilst trying to open the zip file."
	End
EndIf
 
; Extract our file
Local fileName$		= ZipApi_ExtractFile(zipIn, "example.txt")
 
; Print some file information
Print "File was extracted to '" + fileName + "'"
Print "Extracted size : " + FileSize(fileName) + " bytes"
 
; Close & cleanup
ZipApi_Close(zipIn)
DeleteFile(fileName)
 


Free Game Downloads | Site Map | Links | Contact Us

© 2005-2007 Sodaware. All rights reserved. About Us | Privacy Policy