Visual FoxPro
Visual FoxPro
Transition from Zip.AppendBd to Zip.AddBd
Provides instructions for replacing deprecated AppendBd method calls with AddBd.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loZip
LOCAL lcPathInZip
LOCAL loBd
LOCAL loEntryObj
LOCAL loZe
LOCAL lnIndex
lnSuccess = 0
loZip = CreateObject('Chilkat.Zip')
* ...
* ...
lcPathInZip = "example.dat"
loBd = CreateObject('Chilkat.BinData')
loBd.LoadFile("c:/someDir/example.dat")
* ------------------------------------------------------------------------
* The AppendBd method is deprecated:
* AppendBd returns the zip entry object, which is usually not needed.
loEntryObj = loZip.AppendBd(lcPathInZip,loBd)
IF (loZip.LastMethodSuccess = 0) THEN
? loZip.LastErrorText
RELEASE loZip
RELEASE loBd
CANCEL
ENDIF
* ...
* ...
RELEASE loEntryObj
* ------------------------------------------------------------------------
* Do the equivalent using AddBd.
* Instead of returning the zip entry object, we just return success/failure.
lnSuccess = loZip.AddBd(lcPathInZip,loBd)
IF (lnSuccess = 0) THEN
? loZip.LastErrorText
RELEASE loZip
RELEASE loBd
CANCEL
ENDIF
* Do the following if you need the zip entry object for what was just appended.
* The newly appended entry is the last one.
loZe = CreateObject('Chilkat.ZipEntry')
lnIndex = loZip.NumEntries - 1
loZip.EntryAt(lnIndex,loZe)
RELEASE loZip
RELEASE loBd
RELEASE loZe