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

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

  
/* This script shows how to use the RxZip add-on DLL to create a ZIP archive
 * in memory.
 */

OPTIONS "C_CALL LABELCHECK"

/* Register the Rxzip add-on DLL */
LIBRARY rxzip

/* Tell RxZip to raise SYNTAX condition for any failure with a Zip function */
ziperr = "SYNTAX"
zipheading = 1

/* Create a text file named "Data1.txt" on disk. This is just a file for our test. */
CHAROUT("data1.txt", "This is some data." || "0D0A0D0A"x || "This is line two."|| "0D0A"x)
LINEOUT("data1.txt")

/* Create another text file named "Data2.txt" on disk. */
CHAROUT("data2.txt", "This is a test of the RxZip add-on dll." || "0D0A0D0A"x || "Hopefully this worked!"|| "0D0A"x)
LINEOUT("data2.txt")

DO
	/* Create a ZIP archive named "test.zip" on disk (in the current directory).
	 * Store the ZIP handle in a variable named "ZipHandle".
	 */
	zipcreate("ZipHandle", "test.zip")

	/* Add the contents of the Data1 file to the ZIP, and give it the name "data1.txt". */
	zipadd(ziphandle,  "data1.txt")

	/* Add the contents of the Data2 file to the ZIP, and give it the name "data2.txt". */
	zipadd(ziphandle,  "data2.txt")

	/* Here we could call ZipAdd to add more disk files, the contents of some variables,
	 * or the output of a pipe, to the ZIP archive.
	 */

	/* 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 created above is closed. */
		IF EXISTS("ZIPHANDLE") THEN zipclose(ziphandle)

		/* Delete the text files. */
		DELETEFILE("data1.txt")
		DELETEFILE("data2.txt")
END
掌柜推荐
 
 
¥289.00 ·
 
 
¥1,080.00 ·
 
 
¥1,380.00 ·
 
 
¥638.00 ·
 
 
¥1,290.00 ·
 
 
¥1,420.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:49:38