Guidance
指路人
g.yi.org
Software / Reginald / Examples / zipexams / UnzipMem.rex

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* This script shows how to use the RxZip add-on DLL to unzip a ZIP archive
 * that is loaded into memory. NOTE: To create the test archive, run the
 * ZipVars.rex example.
 */

OPTIONS "C_CALL"

/* Register the RxUnzip add-on DLL */
LIBRARY rxunzip

/* Tell RxUnzip to raise SYNTAX condition for any failure with an Unzip function */
ziperr = "SYNTAX"
zipheading = 1

/* Read the ZIP archive into a variable. */
total = CHARS("MyTest.zip")
IF total > 0 THEN DO
	data = CHARIN("MyTest.zip", , total)

	DO
		/* Set the ZIP archive to be unzipped.
		 * Store the ZIP handle in a variable named "ZipHandle".
		 */
		unzipopen("ZipHandle", data, "MEMORY")

		/* Determine how many items are in the archive. */
		unzipfinditem(ziphandle, "Count")

		/* Unzip each item in the archive. */
		DO i = 1 TO count

			/* Set the next item as the current item, and get info on it. */
			unzipsetcurrentitem(ziphandle, "Info", i)

			SAY "Unzipping..." info.0
			SAY "Size =" info.1

			unzipgetitem(ziphandle, info.0)
		END

		/* We're done with our ZIP archive on disk, so just let the FINALLY section close it. */

		CATCH SYNTAX
			CONDITION('M')

		FINALLY
			/* Make sure any ZIP archive we opened above is closed. */
			IF EXISTS("ZIPHANDLE") THEN unzipclose(ziphandle)
	END
END
ELSE SAY "Can't find MyTest.zip"
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2024-6-23  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:49:38