boost iostreams 压缩文件
来源:互联网 发布:php软件环境是什么 编辑:程序博客网 时间:2024/05/17 06:53
#include<iostream>#include <vector>#include <iostream>#include <fstream>#include <string>#include <boost/range/iterator_range.hpp>#include <boost/algorithm/string.hpp>#include <boost/lexical_cast.hpp>#include <boost/iostreams/stream.hpp>#include <boost/iostreams/filtering_stream.hpp>#include <boost/iostreams/filter/zlib.hpp>#include <boost/iostreams/device/back_inserter.hpp>#include <boost/iostreams/device/array.hpp>#include <boost/iostreams/copy.hpp>#include <boost/iostreams/filter/zlib.hpp>#include <boost/iostreams/filtering_streambuf.hpp>#include <boost/iostreams/filter/zlib.hpp>using namespace boost;using namespace std;bool compress(){ std::vector<char> content; std::ifstream file; file.open("/home/jk/hello",std::ios::binary); file.seekg(0, std::ios::end); size_t size = file.tellg(); file.seekg(0); content.resize(size); file.read(&(content.front()), size); file.close(); std::vector<char> compressed; boost::iostreams::filtering_streambuf<boost::iostreams::output> compress_out; compress_out.push(boost::iostreams::zlib_compressor()); compress_out.push(boost::iostreams::back_inserter(compressed)); boost::iostreams::copy(boost::make_iterator_range(content), compress_out); std::ofstream save; save.open("/home/jk/hello.zip",std::ios::binary); save.write(&(compressed.front()), compressed.size()); save.close(); return true;}int main(){ compress(); return 0x00;}
- boost iostreams 压缩文件
- C++ Boost Iostreams
- boost翻译(3):boost.iostreams简介
- 使用Boost.Iostreams实现bzip2格式文件流
- 整合protobuf、boost::iostreams和NetMessage类
- Boost::iostreams 库编译和压缩数据流
- boost翻译(4):boost.iostreams指南--使用Devices
- boost翻译(5):boost.iostreams指南--使用Filters(1)
- boost翻译(6):boost.iostreams指南--使用Filters(2)
- boost翻译(7):boost.iostreams指南--使用Filters(3)
- 使用boost::iostreams库压缩和解压数据
- boost 1.47.0 linux/windows 编译库:regex与iostreams
- boost::iostreams——谁叫你把0x0a转成0x0d 0x0a的混蛋东西
- 压缩文件
- 压缩文件
- 压缩文件
- 压缩文件
- 压缩文件
- 前端常识性的东西
- java和C++中数组的初始化和复制
- Objective-C规范注释心得——同时兼容appledoc(docset、html)与doxygen(html、pdf)的文档生成
- SQL Server 进行同步复制技术时需要注意事项
- C++ Primer 中文版 学习笔记(十二)
- boost iostreams 压缩文件
- python爬虫实现(使用线程池)
- dedecms更新时报模板不存在,无法解析
- bochs & nasm的安装
- [python脚本]爬blackhat官网的paper
- STL中对vector容器中的结构体进行排序
- java设计模式---状态模式
- poj 2777
- Binder进程通信介绍