tcpip数据包编码解析(chunk and gzip)_space of Jialy_百度空间
// 使用zlib库的代码#include "zlib/zlib.h"void uncompresstorrent(char *src, char *dst)
{
gzFile *gzfp=gzopen(src,"rb");
FILE *fp=fopen(dst,"wb");
char in[CHUNK];
int retlen = -1; while(0 != (retlen=gzread(gzfp,in,CHUNK)))
{
fwrite(in,1,retlen,fp);
}
gzclose(gzfp);
fclose(fp);
}(编译是需要带 -Lzlib -lz 参数)/////////////////////////////////