Sample code for 30+ languages & platforms
Visual FoxPro

bz2 Compress File

Compress a file to the bz2 file format.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loBz2

lnSuccess = 0

* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loBz2 = CreateObject('Chilkat.Bz2')

* Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
lnSuccess = loBz2.CompressFile("qa_data/hamlet.xml","qa_output/hamlet.bz2")
IF (lnSuccess <> 1) THEN
    ? loBz2.LastErrorText
    RELEASE loBz2
    CANCEL
ENDIF

? "Success."

RELEASE loBz2