Sample code for 30+ languages & platforms
PureBasic

Compute CRC32 of a File

Calculates the CRC32 of a file's contents and returns the 32-bit CRC as a hex string.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkZipCrc.pb"

Procedure ChilkatExample()

    zipCrc.i = CkZipCrc::ckCreate()
    If zipCrc.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; Use a relative for absolute path to the file..
    crc.i = CkZipCrc::ckFileCrc(zipCrc,"qa_data/hamlet.xml")
    hexStr.s = CkZipCrc::ckToHex(zipCrc,crc)
    Debug hexStr


    CkZipCrc::ckDispose(zipCrc)


    ProcedureReturn
EndProcedure