User Tools

Site Tools


compress.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== COMPRESS (compress data from the passed buffer) ====== Previous pageReturn to chapter overviewNext page

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.

blk2blue.jpg

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 &amp;= COMPRESS(TextBuffer,-1,result)

See Also:

Decompress

compress.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1