学习笔记:zlib+boost 的用法

#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace boost::iostreams;

int main()
{
    std::vector v;
    back_insert_device> snk{ v };
    filtering_ostream os;
    os.push(zlib_compressor{});
    os.push(snk);
    os << "Boost" << std::flush;
    os.pop();

    array_source src{ v.data(), v.size() };
    filtering_istream is;
    is.push(zlib_decompressor{});
    is.push(src);
    std::string s;
    is >> s;
    std::cout << s << '\n';

    system("pause");
}

step1) 下载zlib的源代码zlib-1.2.10.zip,解压缩到d:\thirdparty

step2)    下载boost编译,注意要指定zlib库的文件夹存放位置

bjam toolset=msvc-14.0 --with-iostreams -s ZLIB_SOURCE="d:\thirdparty\zlib-1.2.10" -s ZLIB_INCLUDE="d:\thirdparty\zlib-1.2.10"

step3)  按照点击打开链接此文档使用

你可能感兴趣的:(学习笔记:zlib+boost 的用法)