Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Transition from Zip.AppendString to Zip.AddString

Provides instructions for replacing deprecated AppendString method calls with AddString.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oZip
LOCAL cPathInZip
LOCAL cTextData
LOCAL oEntryObj
LOCAL oZe
LOCAL nIndex

nSuccess := 0

oZip := CreateObject("Chilkat.Zip")

//  ...
//  ...
cPathInZip := "example.txt"
cTextData := "This is a test"

//  ------------------------------------------------------------------------
//  The AppendString method is deprecated:

oEntryObj := oZip:AppendString(cPathInZip, cTextData)
IF (oZip:LastMethodSuccess == 0)
    ? oZip:LastErrorText
    oZip:destroy()
    RETURN
ENDIF

//  ...
//  ...

oEntryObj:destroy()

//  ------------------------------------------------------------------------
//  Do the equivalent using AddString.

//  Instead of returning the zip entry object, we just return success/failure.
nSuccess := oZip:AddString(cPathInZip, cTextData, "utf-8")
IF (nSuccess == 0)
    ? oZip:LastErrorText
    oZip:destroy()
    RETURN
ENDIF

//  Do the following if you need the zip entry object for what was just appended.
//  The newly appended entry is the last one.
oZe := CreateObject("Chilkat.ZipEntry")
nIndex := oZip:NumEntries - 1
oZip:EntryAt(nIndex, oZe)

oZip:destroy()
oZe:destroy()