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
3
votes
2 answers

Standard way to implement a buffered stream that flushes at a constant interval?

I'm simulating packets from a source that produces packets at a given packet/second interval. I want to make a stream class that operates like an ostream object, allowing operator<< to be used to output things through it, but with the caveat that…
Bradley Swain
  • 804
  • 5
  • 12
3
votes
1 answer

Using boost iostreams filters (close and non-copyable)

After asking question about crypto++ I tried to implement it using boost iostreams. I produced following code: #include #include #include #include #include…
Maciej Piechotka
  • 7,028
  • 6
  • 39
  • 61
3
votes
1 answer

How to streaming decompress using boost iostreams

I'm using boost iostreams (1.64.0) in order to decompress zlib data. I want to do streaming decompression. That means the compressed data are unpredictable size. I wrote the following code example. #include #include #include…
Takatoshi Kondo
  • 3,111
  • 17
  • 36
3
votes
1 answer

How to flush memory-mapped files using Boost's `mapped_file_sink` class?

Using the Boost Libraries version 1.62.0 and the mapped_file_sink class from Boost.IOStreams. I want to flush the written data to disk at will, but there is no mapped_file_sink::flush() member function. My questions are: How can I flush the written…
user7023624
  • 571
  • 5
  • 14
3
votes
1 answer

Zlib compression in boost::iostreams not compatible with zlib.NET

I want to send compressed data between my C# to a C++ application in ZLIB format. In C++, I use the zlib_compressor/zlib_decompressor available in boost::iostreams. In C#, I am currently using the ZOutputStream available in the zlib.NET library.…
Johan
  • 51
  • 3
3
votes
1 answer

How to use a compressor Boost::Iostreams filter as a sink in Boost::Log

I'm trying to compress log files created using the Boost Log library instantaneously by utilizing boost::iostreams::gzip_compressor. So when I call BOOST_LOG(), output gets compressed on-the-fly. Here's what I tried so far: #include…
seldak
  • 281
  • 3
  • 12
3
votes
1 answer

Using boost::iostreams::mapped_file

I am very new to the memory mapping and trying to understand memory mapped files to use them in my project(linux based). My requirement is to write & then read from memory mapped files. I wrote a sample program which only writes and it works fine…
Neha
  • 225
  • 1
  • 5
  • 12
3
votes
3 answers

How to pipe into std::cout with boost::iostreams

I am new to boost::iostreams so this might be trivial: Assuming namespace io = boost::iostreams; this works io::filtering_ostream out(std::cout); out << "some\nstring\n"; and this works std::string result; io::filtering_ostream out(io::counter() |…
Elliot Cameron
  • 5,235
  • 2
  • 27
  • 34
3
votes
1 answer

boost::iostreams::copy() closes the source but not the sink

I am trying to use boost::iostreams to compress data. The doc for copy() says that its two arguments are closed at the end by calling the template function close() on both of them. My test code is: #include #include #include…
Moncef M.
  • 1,223
  • 2
  • 14
  • 15
3
votes
0 answers

Writing Eof to a stream

I want to boost-process to start a process and write/read to its stdin/stdout. In principle the code works but it doesn't terminate. It seems to me that the external program does not receive a EOF, although I close the stream to write to the…
pyfex
  • 1,195
  • 1
  • 8
  • 13
3
votes
1 answer

C++ Boost io streams, error handling

Is it possible to make a custom stream work like the stanadrd ones in regard for errors? That is by default use the good/fail/bad/eof bits rather than exceptions? The boost docs only mention throwing an std::failure for stream errors and letting…
Fire Lancer
  • 29,364
  • 31
  • 116
  • 182
2
votes
0 answers

How to use boost::iostreams filter directly

How can I use boost::iostreams::gzip_decompressor to decompress a sequence of boost::asio::streambuf's? Here is what I had in mind (non-working pseudo code): struct Foo { public: void sinkData(boost::asio::streambuf & buf) { …
Allan
  • 4,562
  • 8
  • 38
  • 59
2
votes
1 answer

alternative to using std::getline for boost::iostream::filtering_istream

I have a binary file compressed in gz which I wish to stream using boost::iostream. After searching the web the past few hours, I have found a nice code snippet that does what I want, except for std::getline: try { std::ifstream…
MoneyBall
  • 2,343
  • 5
  • 26
  • 59
2
votes
4 answers

Simple server/client boost example not working

Learning boost, and compiled their daytime server client example. Since I cant use port 13 that is in the example I only changed the port numbers in the server and client example. Server runs fine, but the client doesnt connect it seems, and no…
Milan
  • 15,389
  • 20
  • 57
  • 65
2
votes
2 answers

boost socket iostreams echo server with zlib compression sleeps until the connection will be closed

I try to create simple echo server with zlib compression following this and this examples. My idea is to send some string now because I can convert POD types to string (std::string(reinterpret_cast(&pod), sizeof(pod))) before sending…
Bogdan
  • 558
  • 2
  • 8
  • 22