[ACCEPTED]-How can I easily compress and decompress files using zlib?-compression
Accepted answer
For decompression:
char buf[1024*1024*16];
gzFile *fi = (gzFile *)gzopen("file.gz","rb");
gzrewind(fi);
while(!gzeof(fi))
{
int len = gzread(fi,buf,sizeof(buf));
//buf contains len bytes of decompressed data
}
gzclose(fi);
For compression
gzFile *fi = (gzFile *)gzopen("file.gz","wb");
gzwrite(fi,"my decompressed data",strlen("my decompressed data"));
gzclose(fi);
0
Please read through this. The information 2 is already available here:
That is the first 1 link that shows up even on google.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.