请问各位大佬,为什么我使用zlib解压数据会出现多余字节. 解压不正确. 是我哪里用错了吗? 下面是我的压缩和解压代码: =================================================================== //读取并打包资源文件; UINT ReadLen = fread(TmpData, sizeof(char), FileLen, TmpFile); //申请压缩缓冲区; UINT zliblen = compressBound(ReadLen); void *zlibData = LocalAlloc(LMEM_ZEROINIT, zliblen + 10); if (!zlibData)return FALSE; /压缩资源包数据; compress((Bytef*)zlibData, (uLongf*)&zliblen, (Bytef*)TmpData, FileLen); //解压出文件 FILE *pf = fopen("E:\\ProjectCode\\C&C++\\Game\\Resource\\Debug\\New\\uncompress.db", "w"); //临时解压数据置零 ZeroMemory(TmpData, FileLen); //解压数据 uncompress((Bytef*)TmpData, (uLongf*)&FileLen, (Bytef*)zlibData, zliblen); //写出解压数据到文件; fwrite(TmpData, FileLen, 1, pf); fclose(pf);
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
风间仁 fopen("", "wb");