求大神指导关于gzip解压,出有关问题

求大神指导关于gzip解压,出问题!
我从http上下载了gizp格式的数据,用解压缩软件已经解压成功,我现在想自己写解压代码,发现解压之后的都是空白,不知道什么原因,解压代码如下
#include <stdio.h>    
#include "zlib.h"    
#pragma comment(lib, "./zlib1.lib")    

int main()
{   
/* 原始数据 */
FILE* p=fopen("mysocket_test.gzip","rb+");
FILE* p2=fopen("123.txt","wb");
   
unsigned char buf[104857] = {0};   
unsigned char strDst[104857] = {0};     
unsigned long bufLen = sizeof(buf);   
unsigned long dstLen = sizeof(strDst);   
fread(buf,1,145910,p);  
 
/* 解压缩 */   
uncompress(strDst, &dstLen, buf, 145910);   
printf("%s\n",strDst);
fwrite(strDst,1,dstLen,p2);
return 0;   
}  
其中mysocket_test.gzip放着的是gzip压缩的数据,大小是145910.

------解决方案--------------------
大哥你压缩了以后都145910了,你解压的buffer才104857,肯定放不下 啊,另外,看Unconpress的返回值,zlib.h里有错误吗的描述。
------解决方案--------------------
引用:
引用:引用:
大哥你压缩了以后都145910了,你解压的buffer才104857,肯定放不下 啊,另外,看Unconpress的返回值,zlib.h里有错误吗的描述。大哥,分配的是不够,我改成了1048576,结果还是空白,返回值是Z_DATA_ERROR,怎么解决啊?实在是不了解zlib我把……


zlib 里有sample code。请参阅。我看的是 V1.2.7的版本。

/* ===========================================================================
 * Test compress() and uncompress()
 */
void test_compress(compr, comprLen, uncompr, uncomprLen)
    Byte *compr, *uncompr;
    uLong comprLen, uncomprLen;
{
    int err;
    uLong len = (uLong)strlen(hello)+1;

    err = compress(compr, &comprLen, (const Bytef*)hello, len);
    CHECK_ERR(err, "compress");

    strcpy((char*)uncompr, "garbage");

    err = uncompress(uncompr, &uncomprLen, compr, comprLen);
    CHECK_ERR(err, "uncompress");

    if (strcmp((char*)uncompr, hello)) {
        fprintf(stderr, "bad uncompress\n");
        exit(1);
    } else {
        printf("uncompress(): %s\n", (char *)uncompr);
    }
}

/* ===========================================================================
 * Usage:  example [output.gz  [input.gz]]
 */

int main(argc, argv)
    int argc;
    char *argv[];
{
    Byte *compr, *uncompr;
    uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
    uLong uncomprLen = comprLen;
    static const char* myVersion = ZLIB_VERSION;

    if (zlibVersion()[0] != myVersion[0]) {