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

Transition from Zip.AppendBd to Zip.AddBd

Provides instructions for replacing deprecated AppendBd method calls with AddBd.

Chilkat Xbase++ Downloads

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

nSuccess := 0

oZip := CreateObject("Chilkat.Zip")

//  ...
//  ...

cPathInZip := "example.dat"

oBd := CreateObject("Chilkat.BinData")
oBd:LoadFile("c:/someDir/example.dat")

//  ------------------------------------------------------------------------
//  The AppendBd method is deprecated:
//  AppendBd returns the zip entry object, which is usually not needed.

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

//  ...
//  ...

oEntryObj:destroy()

//  ------------------------------------------------------------------------
//  Do the equivalent using AddBd.

//  Instead of returning the zip entry object, we just return success/failure.
nSuccess := oZip:AddBd(cPathInZip, oBd)
IF (nSuccess == 0)
    ? oZip:LastErrorText
    oZip:destroy()
    oBd: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()
oBd:destroy()
oZe:destroy()