COMPRESS (compress data from the passed buffer)

Top  Previous  Next


COMPRESS (*STRING srcBuf, SIGNED level = -1, <*SIGNED result>)


Returns a reference to a buffer with compressed data (if compression is successful). If an error occurs or the source data is empty, the function returns NULL. The program must DISPOSE the returned buffer after usage.


The COMPRESS function provides in-memory data compression. If compression

is successful, Compress allocates an output buffer, and returns it. The program is

responsible for disposing this buffer after usage. 


Buffer containing data to compress


Desired level of compression: from 0 (no compression) to 9 (maximum compression).  A value of -1 uses the default level selected by the library.


If compression is successful, the passed variable is set to the number of bytes written to the output buffer. If there is an error the variable is set to a negative error code


Errors Posted:


stream error


Compressed data is corrupt


Insufficient memory


Destination buffer (for DECOMPRESS) or temporary buffer (for COMPRESS) has insufficient size



compressedData &= COMPRESS(TextBuffer,-1,result)



See Also: