'' Store the crc32 checksum of the input data, so we can check if the '' uncompression has worked.DimAsUInteger crc = crc32(0, src, src_len)

'' Perform the compression. dest_len is passed as its address, because when'' the function returns it will contain the size of the compressed data.
errlev = compress(dest, @dest_len, src, src_len)If errlev <> 0Then'' If the function returns a value other than 0 then an error occured.Print"**** Error during compress - code " & errlev & " ****"End IfPrint"Compressed to : " & dest_len & " bytes."

'' NOTE: in normal use in a program, you would store the src_len, in order to'' be able to tell uncompress the output size. However in this example we can'' just leave it in src_len. The same goes for dest_len, which is the compressed'' datas size.

'' Wipe the src buffer before we uncompress to it, so that we can check if the '' decompression has worked.For i AsInteger = 0To src_len - 1
src[i] = 0Next

'' Perform a decompression. This time we uncompress the data back to src. '' src_len is passed as its address, because when'' the function returns it will contain the size of the uncompressed data.
errlev = uncompress(src, @src_len, dest, dest_len)If errlev <> 0Then'' If the function returns a value other than 0 then an error occured.Print"**** Error during uncompress - code " & errlev & " ****"End IfPrint"Uncompressed to : " & src_len & " bytes."