Zlib simple sample compress and uncompress code
Zlib simple examples of compress and uncompress code, for this problem, this article describes in detail the corresponding analysis and solutions, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Zlib simple sample code, compress, uncompress:
# include # include using namespace std;int main (int argc, char * argv []) {/ / unsigned char szSrc [] = "test the compression and uncompression of zlib."; unsigned long nSrcLen = sizeof (szSrc); unsigned char szZip [1024] = {0}; unsigned long nZipLen = 1024; compress (szZip, & nZipLen, szSrc, nSrcLen); / / unsigned char szUnZip [1024] = {0} Unsigned long nUnZipLen = 1024; uncompress (szUnZip, & nUnZipLen, szZip, nZipLen); / / cout