I am trying to implement the zlib.h deflate and inflate functions to compress and decompress a char array (not a file).
I would like to know if the following syntax
zlib already has a simple inflate/deflate function you can use.
char a[50] = "Hello, world!";
char b[50];
char c[50];
uLong ucompSize = strlen(a)+1; // "Hello, world!" + NULL delimiter.
uLong compSize = compressBound(ucompSize);
// Deflate
compress((Bytef *)b, &compSize, (Bytef *)a, ucompSize);
// Inflate
uncompress((Bytef *)c, &ucompSize, (Bytef *)b, compSize);
When in doubt, check out the zlib manual. My code is crappy, sorry =/