Sample code for 30+ languages & platforms
Xbase++

bz2 Compress File

Compress a file to the bz2 file format.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oBz2

nSuccess := 0

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

oBz2 := CreateObject("Chilkat.Bz2")

//  Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
nSuccess := oBz2:CompressFile("qa_data/hamlet.xml", "qa_output/hamlet.bz2")
IF (nSuccess != 1)
    ? oBz2:LastErrorText
    oBz2:destroy()
    RETURN
ENDIF

? "Success."

oBz2:destroy()