Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Create a Zip from In-Memory DataThis example shows how to create a Zip where the data source is in memory. ***********************************************************
*** Visual FoxPro Example Programs by Chilkat Software
*** Visual FoxPro Source Code Examples for Zip Compression
*** Visual FoxPro Examples for Zip Compression
*** Zip Compression in Visual FoxPro
***********************************************************
* Create a Zip from data in memory.
LOCAL zip, s, i, zip2, zipEntry, s2
zip = CreateObject('Chilkat.Zip2')
zip.UnlockComponent('anything for 30-day trial')
* Initialize a new Zip object.
zip.NewZip("myZip.zip");
* Generate some text to be stored in the Zip.
s = ""
for i = 0 to 100
s = s + "This data will be stored in a Zip file." + CHR(13) + CHR(10)
NEXT
* Append the data to the Zip object.
* We can set the last parameter to 0 to append the entire string.
zip.AppendData("stringData.txt",s,0)
zip.WriteZipAndClose
RELEASE zip
* Now let's re-open the Zip, modify the data, and rewrite the Zip.
zip2 = CreateObject('Chilkat.Zip2')
* Open the Zip.
zip2.OpenZip("myZip.zip")
* Get the first entry in the Zip and inflate the data to a string.
zipEntry = zip2.GetEntryByIndex(0)
s2 = zipEntry.InflateToString2()
* Replace all occurances of the string "data" with "text"
s2 = "This is additional data" + CHR(13) + CHR(10) + s2
* Replace this Zip entry's data.
zipEntry.ReplaceData(s2)
* Save the Zip to "myZip2.zip"
zip2.FileName = "myZip2.zip"
zip2.WriteZipAndClose
RELEASE zip2
RETURN .T.
***********************************************************
*** Visual FoxPro Source Code Samples for Zip Compression
*** Visual FoxPro Sample Programs by Chilkat Software
*** Visual FoxPro Samples for Zip Compression
*** Zip Compression in Visual FoxPro
***********************************************************
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser