Article # 666, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
Compressing files and buffers with the compress library.
If you want to compress a file or some block of data in memory, you can use the routine CompressDecompress() (defined in compress.h). This compression uses the PKWare compression library, version 1.02. extern word _pascal CompressDecompress(CompLibFlags flags, FileHandle sourceFileHandle, void *sourceBuffer, word sourceBufferSize, FileHandle destFileHandle, void *destBuffer); The return value is the number of bytes written to the destination. Here is a description of the flags you can set: CLF_SOURCE_IS_BUFFER Set this bit if you are using *sourceBuffer instead of sourceFileHandle. CLF_DEST_IS_BUFFER Set this bit if you are using *destBuffer instead of destFileHandle. CLF_DECOMPRESS Set this if the source is compressed and you want to decompress it. If this bit is clear, the routine will perform compression. CLF_MOSTLY_ASCII Set if the source is mostly ASCII characters.