C++封装zlib库压缩字符串

可以看一下我的Github项目,使用封装zlib库的ZLibString类进行压缩C++字符串。

  • 使用
    将ZLibString.h,ZLibString.cpp文件加入项目,使用以下方法进行压缩,解压缩。

// 压缩,pcContentBuf:要压缩的内容 pcCompBuf:压缩后的内容 ulCompLen:得到压缩后的长度
bool Compress(const char* pcContentBuf, char* pcCompBuf, unsigned long& ulCompLen);
// 解压,pcCompBuf:压缩的内容, pcUnCompBuf:解压后的内容 ulCompLen:传入压缩内容的长度
bool UnCompress(const char* pcCompBuf, char* pcUnCompBuf, unsigned long ulCompLen);
```
具体见源码。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容