Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Lianja) Zip Append StringBuilderSee more Zip ExamplesAppend the contents of a Chilkat StringBuilder object to a .zip. Note: This example requires Chilkat v10.0.0 or later.
// This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loZip = createobject("CkZip") lcZipPath = "c:/temp/qa_output/out.zip" loZip.NewZip(lcZipPath) loSb = createobject("CkStringBuilder") i = 0 do while i < 100 loSb.AppendLine("This is a test",.T.) i = i + 1 enddo loZip.AppendSb("this_is_a_test.txt",loSb,"utf-8") llSuccess = loZip.WriteZipAndClose() if (llSuccess = .F.) then ? loZip.LastErrorText release loZip release loSb return endif ? "Success 1." // Perhaps you want to add a file to an existing .zip loZip2 = createobject("CkZip") // Open the .zip we just wrote.. llSuccess = loZip2.OpenZip(lcZipPath) loSb.Clear() i = 0 do while i < 100 loSb.AppendLine("This is a test 2",.T.) i = i + 1 enddo loZip2.AppendSb("this_is_a_test_2.txt",loSb,"utf-8") lcZipPath2 = "c:/temp/qa_output/out2.zip" loZip2.FileName = lcZipPath2 llSuccess = loZip2.WriteZipAndClose() if (llSuccess = .F.) then ? loZip2.LastErrorText release loZip release loSb release loZip2 return endif ? "Success 2." release loZip release loSb release loZip2 |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.