How can I easily compress and decompress files using zlib? [closed]
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . How can I easily compress and decompress files using zlib? 回答1: 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