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. 
  

srcBuf

Buffer containing data to compress

level

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

result

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:

-2

stream error

-3

Compressed data is corrupt

-4

Insufficient memory

-5

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

 

Example:

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

 

 

See Also:

Decompress