Guest User

Untitled

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. //credit bobobobo.wordpress.com/2008/02/23/how-to-use-zlib/
  2.  
  3.  int z_result = compress(
  4.  
  5.         dataCompressed,         // destination buffer,
  6.                                 // must be at least
  7.                                 // (1.01X + 12) bytes as large
  8.                                 // as source.. we made it 1.1X + 12bytes
  9.  
  10.         &sizeDataCompressed,    // pointer to var containing
  11.                                 // the current size of the
  12.                                 // destination buffer.
  13.                                 // WHEN this function completes,
  14.                                 // this var will be updated to
  15.                                 // contain the NEW size of the
  16.                                 // compressed data in bytes.
  17.  
  18.         dataOriginal,           // source data for compression
  19.  
  20.         sizeDataOriginal ) ;    // size of source data in bytes
  21.  
  22.     switch( z_result )
  23.     {
  24.     case Z_OK:
  25.         printf("***** SUCCESS! *****\n");
  26.         break;
  27.  
  28.     case Z_MEM_ERROR:
  29.         printf("out of memory\n");
  30.         exit(1);    // quit.
  31.         break;
  32.  
  33.     case Z_BUF_ERROR:
  34.         printf("output buffer wasn't large enough!\n");
  35.         exit(1);    // quit.
  36.         break;
  37.     }
Add Comment
Please, Sign In to add comment