PureBasic
PureBasic
bz2 Compress File
Compress a file to the bz2 file format.Chilkat PureBasic Downloads
IncludeFile "CkBz2.pb"
Procedure ChilkatExample()
success.i = 0
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
bz2.i = CkBz2::ckCreate()
If bz2.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
success = CkBz2::ckCompressFile(bz2,"qa_data/hamlet.xml","qa_output/hamlet.bz2")
If success <> 1
Debug CkBz2::ckLastErrorText(bz2)
CkBz2::ckDispose(bz2)
ProcedureReturn
EndIf
Debug "Success."
CkBz2::ckDispose(bz2)
ProcedureReturn
EndProcedure