Sample code for 30+ languages & platforms
Unicode C

bz2 Compress File

Compress a file to the bz2 file format.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkBz2W.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkBz2W bz2;

    success = FALSE;

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

    bz2 = CkBz2W_Create();

    //  Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
    success = CkBz2W_CompressFile(bz2,L"qa_data/hamlet.xml",L"qa_output/hamlet.bz2");
    if (success != TRUE) {
        wprintf(L"%s\n",CkBz2W_lastErrorText(bz2));
        CkBz2W_Dispose(bz2);
        return;
    }

    wprintf(L"Success.\n");


    CkBz2W_Dispose(bz2);

    }