Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //credit bobobobo.wordpress.com/2008/02/23/how-to-use-zlib/
- int z_result = compress(
- dataCompressed, // destination buffer,
- // must be at least
- // (1.01X + 12) bytes as large
- // as source.. we made it 1.1X + 12bytes
- &sizeDataCompressed, // pointer to var containing
- // the current size of the
- // destination buffer.
- // WHEN this function completes,
- // this var will be updated to
- // contain the NEW size of the
- // compressed data in bytes.
- dataOriginal, // source data for compression
- sizeDataOriginal ) ; // size of source data in bytes
- switch( z_result )
- {
- case Z_OK:
- printf("***** SUCCESS! *****\n");
- break;
- case Z_MEM_ERROR:
- printf("out of memory\n");
- exit(1); // quit.
- break;
- case Z_BUF_ERROR:
- printf("output buffer wasn't large enough!\n");
- exit(1); // quit.
- break;
- }
Add Comment
Please, Sign In to add comment