一般来说数据存储的时候会先进行压缩,可以使用zlib.h库中提供的compress函数进行压缩:
int compress(Bytef* dest, uLongf* destLen, const Bytef* source, uLongf* sourceLen);
返回Z_OK说明压缩成功,返回Z_MEM_ERROR说明内存不够,返回Z_BUF_ERROR说明输出buffer内存不够
参考资料:
一般来说数据存储的时候会先进行压缩,可以使用zlib.h库中提供的compress函数进行压缩:
int compress(Bytef* dest, uLongf* destLen, const Bytef* source, uLongf* sourceLen);
返回Z_OK说明压缩成功,返回Z_MEM_ERROR说明内存不够,返回Z_BUF_ERROR说明输出buffer内存不够
参考资料: