Previous topic

mem_compare

Next topic

mem_dump

This Page

mem_compressΒΆ

mem_compress compresses a string which may contain 0-characters.

ssCompressed = mem_compress(ssString)

Return Value

ssCompressed is the compressed string. The function inserts an 8 byte long header at the beginning of the string. The header starts with the characters “gzcx00” followed by a 32-Bit value in little endian byte-order (Intel) which contains the string length of the uncompressed string.

Parameters

ssString

ssString is a scalar string.

Example

filename = GetRootDirectory() + "/script/mn_grid.ic";
fp = fopen(filename, "r");
s = fread(fp, "char");
fclose(fp);
c = mem_compress(s);
print "Size uncompressed:", strlen(s);
print "Size compressed:", mem_len(c);

Output:

Size uncompressed:
91099.0000
Size compressed:
17992.0000

Comment

This function uses the zlib-Library (http://www.gzip.org/zlib/). Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler.

History

Version Description
5.0.0 ???
4.2.0 New

id-1359285