Sample code for 30+ languages & platforms
DataFlex

bz2 Compress File

Compress a file to the bz2 file format.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoBz2
    String sTemp1

    Move False To iSuccess

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

    Get Create (RefClass(cComChilkatBz2)) To hoBz2
    If (Not(IsComObjectCreated(hoBz2))) Begin
        Send CreateComObject of hoBz2
    End

    // Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
    Get ComCompressFile Of hoBz2 "qa_data/hamlet.xml" "qa_output/hamlet.bz2" To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoBz2 To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "Success."


End_Procedure