zlib在windows上的编译
来源:互联网 发布:python列表推导式 编辑:程序博客网 时间:2024/06/06 19:28
from:
http://blog.sina.com.cn/s/blog_96ea53fb0101ldd9.html
http://blog.csdn.net/yuzhiyuxia/article/details/25826639
http://blog.csdn.net/htttw/article/details/7616124
首先从http://www.zlib.net/下载了最新的源代码,版本是1.2.8
解压后,实际已经提供了在VC下编译的工程,目录为:
zlib-1.2.8\contrib\vstudio
其中只有vc9和vc10
编译
直接使用其库,下载zlib128-dll,里面有.LIB, .DLL, .H文件
导入到自己的工程
//解压文件
CFile bmpFile(_T("C:\\dh_255.bmp"), CFile::modeRead|CFile::typeBinary);
unsigned long lSize = bmpFile.GetLength();
CString strSize;
strSize.Format(_T("%8x"), lSize); // 文件大小
unsigned long lSizeDest = lSize;
if (lSize > 0)
{
BYTE* pBufSrc = new BYTE[lSize];
memset(pBufSrc, 0, lSize);
BYTE* pBufDest = new BYTE[lSizeDest];
memset(pBufDest, 0, lSizeDest);
bmpFile.Read(pBufSrc, lSize);
INT_PTR iComp = compress(pBufDest, &lSizeDest, pBufSrc, lSize);
CFile zipFile(_T("C:\\dh_255.zip"), CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
std::string str;
WCToStr(strSize, str);
zipFile.Write(str.c_str(), strSize.GetLength() + 1);// 存储解压之后的文件大小
zipFile.Seek(9+1, CFile::begin);
zipFile.Write(pBufDest, lSizeDest);
delete [] pBufDest;
pBufDest = NULL;
delete [] pBufSrc;
pBufSrc = NULL;
zipFile.Close();
}
bmpFile.Close();
///* 解压缩 */
CFile zipFile(_T("C:\\dh_255.zip"), CFile::modeRead|CFile::typeBinary);
unsigned long lZipSrc = zipFile.GetLength();
unsigned long lZipDest = lSize+ 10;
BYTE* pBufZip = new BYTE[lZipSrc];
BYTE* pBufSize = new BYTE[9];
memset(pBufZip, 0, lZipSrc);
memset(pBufSize, 0, 9);
zipFile.Read(pBufSize, 9);//////读取 解压之后的文件大小
unsigned long lSizenew = strtoul((const char*)pBufSize, 0, 16);
BYTE* pBufBmp = new BYTE[lSizenew];
memset(pBufBmp, 0, lSizenew);
zipFile.Seek(9+1, CFile::begin);
zipFile.Read(pBufZip, lZipSrc);
INT_PTR iUnComp = uncompress(pBufBmp, &lSizenew, pBufZip, lZipSrc);
CFile destBmpFile(_T("C:\\dh_2550.bmp"), CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
destBmpFile.Write(pBufBmp, lSizenew);
delete [] pBufZip;
pBufZip = NULL;
zipFile.Close();
destBmpFile.Close();
//压缩数据
//* 原始数据 */
unsigned char strSrc[] = "hello world! aaaaa bbbbb ccccc ddddd 中文测试 yes";
unsigned char buf[1024] = {0};
unsigned char strDst[1024] = {0};
unsigned long srcLen = sizeof(strSrc);
unsigned long bufLen = sizeof(buf);
unsigned long dstLen = sizeof(strDst);
//* 压缩 */
compress(buf, &bufLen, strSrc, srcLen);
//
//* 解压缩 */
uncompress(strDst, &dstLen, buf, bufLen);
//* 压缩 */
- zlib在windows上的编译
- 在Windows上编译最新的CURL,含有zlib,openssl
- 记录zlib在windows上编译使用调研的资料和过程
- Windows上编译最新的CURL,含有zlib,openssl
- Windows上编译最新的CURL,含有zlib,openssl
- Windows上编译最新的CURL,含有zlib,openssl
- Windows上编译最新的CURL,含有zlib,openssl
- Windows上编译最新的CURL,含有zlib,openssl
- zlib库 在windows下的编译与使用
- zlib库 在windows下的编译与使用
- windows上编译zlib-1.2.8
- windows上编译zlib-1.2.8
- zlib库在windows系统中的编译
- zlib window上编译
- zlib window上编译
- zlib编译,windows/Linux
- zlib编译,Windows/Ubuntu
- windows 编译zlib
- 第四章
- 【BNU】39676 Point Distance【FFT求矩阵中点对的欧几里德距离】
- 从八皇后问题体会回溯法
- opencv 矩阵
- java中finally与return的执行顺序详解
- zlib在windows上的编译
- 新浪微博
- 1 调试初步
- 面向对象编程的弊端是什么?
- 利用Harris检测子进行角点特征检测
- MD5加密代码
- Android之SDK Manager无法更新终极解决方案
- IPV4 与IPV6 头部结构与其区别
- Remove Element