Xbase++ Requires Chilkat v11.0.0+
Xbase++
Unzip Text File to String
See more Zip Examples
Demonstrates how to open a .zip and extract the 1st file (assuming it's a text file) to a string variable.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oZip
LOCAL oEntry
LOCAL cFileContents
nSuccess := 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oZip := CreateObject("Chilkat.Zip")
nSuccess := oZip:OpenZip("qa_data/zips/EC16100.zip")
IF (nSuccess == 0)
? oZip:LastErrorText
oZip:destroy()
RETURN
ENDIF
// Get the 1st file in the .zip
oEntry := CreateObject("Chilkat.ZipEntry")
nSuccess := oZip:EntryAt(0, oEntry)
IF (nSuccess == 0)
? oZip:LastErrorText
oZip:destroy()
oEntry:destroy()
RETURN
ENDIF
cFileContents := oEntry:UnzipToString(0, "utf-8")
? cFileContents
oZip:destroy()
oEntry:destroy()