Questions tagged [boost-iostreams]

Boost.Iostreams is a C++ framework for defining streams, stream buffers and I/O filters.

Boost.Iostreams has three aims:

  • To make it easy to create standard C++ streams and stream buffers for accessing new Sources and Sinks.
  • To provide a framework for defining Filters and attaching them to standard streams and stream buffers.
  • To provide a collection of ready-to-use Filters, Sources and Sinks.

For example, Boost.Iostreams can be used to create streams to access TCP connections or as a framework for cryptography and data compression. The library includes components for accessing memory-mapped files, for file access using operating system file descriptors, for code conversion, for text filtering with regular expressions, for line-ending conversion and for compression and decompression in the zlib, gzip and bzip2 formats.

160 questions
26
votes
2 answers

How to hook up Boost serialization & iostreams to serialize & gzip an object to string?

I've been using the Boost serialization library, which is actually pretty nice, and lets me make simple wrappers to save my serializable objects to strings, like so: namespace bar = boost::archive; namespace bio = boost::iostreams; template
cce
  • 4,874
  • 2
  • 28
  • 25
21
votes
1 answer

How to build boost iostreams with gzip and bzip2 support on Windows

How do I build boost's iostreams library with gzip and bzip2 support?
Cookie
  • 12,004
  • 13
  • 54
  • 83
14
votes
4 answers

Does Boost.Serialization serialize differently on different platforms?

I use Boost.Serialization to serialize a std::map. The code looks like this void Dictionary::serialize(std::string & buffer) { try { std::stringstream ss; boost::archive::binary_oarchive archive(ss); archive << dict_; buffer =…
Jan Deinhard
  • 19,645
  • 24
  • 81
  • 137
14
votes
1 answer

Boost iostreams with bzip - unresolved symbols

My project was using an older version of Boost's iostreams w/ bzip2. I'm now trying to upgrade to Boost 1.51. At first I did not compile with bzip so obviously I got the linker yelling about libboost_bzip2-vc100-mt-sgd-1_51.lib being missing. I then…
E.K.
  • 321
  • 1
  • 11
13
votes
2 answers

Is there a difference between boost iostream mapped file and boost interprocess mapped file?

I want to create a mapped binary file into memory; however I am not sure how to create the file to be mapped into the system. I read the documentation several times and realize there are 2 mapped file implementations, one in iostream and the other…
Yijinsei
  • 788
  • 2
  • 11
  • 20
12
votes
2 answers

C++ "hello world" Boost tee example program

The Boost C++ library has Function Template tee The class templates tee_filter and tee_device provide two ways to split an output sequence so that all data is directed simultaneously to two different locations. I am looking for a complete C++…
CW Holeman II
  • 4,661
  • 7
  • 41
  • 72
10
votes
1 answer

boost gzip decompress byte array

I implemented the gzip/zlib decompression of files as shown in their examples on the boost site. void CompressionUtils::Inflate(std::ifstream& inputFile, std::ofstream& outputFile) { …
Rob Goodwin
  • 2,676
  • 2
  • 27
  • 47
10
votes
2 answers

How to bind program termination with end-of-stream in Boost.Process 0.5?

In this simple example of Boost.Process 0.5 ( http://www.highscore.de/boost/process0.5/index.html) the output of a program (ls) is feeding a stream. The stream works fine but contrary to the expectation the stream doesn't become invalid (e.g.…
alfC
  • 14,261
  • 4
  • 67
  • 118
9
votes
1 answer

boost::filtering_streambuf with gzip_decompressor(), how to access line by line from file

I wrote a Logparser Application and now I want to implement decompression of .gz files. I tried it with boost::iostreams and zlib which seems to work, but I don't know how to handle the input I get from compressed files. Here's what I…
9
votes
2 answers

how to convert bash script to C++ using boost::iostreams

I'm trying to convert the following bash code into C++ using boost::iostreams: #!/usr/bin/bash ( gzip -cd file1.ext.gz cat file2.ext ) | grep '^regex' # or sed 's/search/replace/' I can open a file and decompress it: std::ifstream…
chris
  • 3,986
  • 1
  • 26
  • 32
9
votes
2 answers

Reinterpret a narrow (char) input stream as a wide (wchar_t) stream

I'm given an std::istream that contains an UTF-16 encoded string. Imagine an UTF-16 encoded text file that has been opened like this: std::ifstream file( "mytext_utf16.txt", std::ios::binary ); I want to pass this stream to a function that takes a…
zett42
  • 25,437
  • 3
  • 35
  • 72
8
votes
1 answer

How to build boost with zlib support?

I'm trying to build Boost C++ libraries version 1.65.1 on Windows with zlib support. I'm using zlib library from Conan package with zlib which I built previously. I'm trying to understand the right steps for building boost with zlib support to use…
bobeff
  • 3,543
  • 3
  • 34
  • 62
7
votes
2 answers

Using boost::iostreams::tee_device?

Can someone help me? I am trying to do something like the following: #include #include #include #include namespace io = boost::iostreams; typedef…
rlbond
  • 65,341
  • 56
  • 178
  • 228
7
votes
3 answers

std::ostream that invokes a callback for each line

I am trying to write a custom std::ostream that invokes a function for every line written to it. That is, I would like the following code to work as documented in comments: my_output_stream s([] (const std::string& line) { …
Alex Shtoff
  • 2,520
  • 1
  • 25
  • 53
7
votes
1 answer

Can someone provide an example of seeking, reading, and writing a >4GB file using boost iostreams

I have read that boost iostreams supposedly supports 64 bit access to large files semi-portable way. Their FAQ mentions 64 bit offset functions, but there is no examples on how to use them. Has anyone used this library for handling large files? A…
Queueless
  • 113
  • 1
  • 7
1
2 3
10 11