Simple Zlib C++ String Compression and Decompression

前端 未结 2 581
耶瑟儿~
耶瑟儿~ 2020-12-31 20:48

I need a simple compression and decompression of a std::string in C++. I looked at this site and the code is for Character array. What I want to implement are the two functi

2条回答
  •  误落风尘
    2020-12-31 21:30

    Compression makes use of all the values available for each byte, so it will appear as 'garbage' or 'weird' characters when attempting to view as ascii. Its expected. You'll need to encode the data for transmission / json packing to avoid nulls. I suggest base 64. Code to do that is available at the link below(which I didn't author so I won't copy here).

    1. http://www.adp-gmbh.ch/cpp/common/base64.html
    2. Binary data JSONCPP

提交回复
热议问题