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

boost::iostreams::zlib::default_noheader seems to be ignored

I'm having trouble getting boost::iostreams's zlib filter to ignore gzip headers ... It seems that setting zlib_param's default_noheader to true and then calling zlib_decompressor() produces the 'data_error' error (incorrect header check). This…
Will
  • 92
  • 1
  • 7
2
votes
3 answers

Why mapped_file::data returns char* instead of void*

Or even better a template ? In case the memory mapped file contains a sequence of 32 bit integers, if data() returned a void*, we could be able to static cast to std::uint32_t directly. Why did boost authors choose to return a char*…
baol
  • 4,362
  • 34
  • 44
2
votes
1 answer

How to interact synchroniously with a process in Boost.Process 0.5

This is a question about Boost.Process 0.5, not any later or earlier version, Boost now contains a Boost.Process library with a different syntax and features. Suppose I have a simple program that ask for a number and return another number,…
alfC
  • 14,261
  • 4
  • 67
  • 118
2
votes
1 answer

Using Boost::iostreams dual-use filters

I was attempting to follow the example of Finite State Filters in the Boost::iostreams documentation. However when I went to use the filter I got an error stating the ::imbue was not accessible because…
nickdmax
  • 539
  • 2
  • 4
  • 11
2
votes
1 answer

Memory usage when using boost::iostreams::mapped_file

I am pasting some code here which uses boost iostream to mmap & then writes to the mapped file: typedef unordered_map work; int main() { work d; d[0] = "a"; …
Neha
  • 225
  • 1
  • 5
  • 12
2
votes
1 answer

Compiling boost with zlib on windows

Is there is good tutorial on how to compile boost with zlib on windows. I looked over boost reference, but it's vague and not enough. I did download zlib dll and source code and made reference in visual studio. I have link error on…
Pritesh Acharya
  • 1,596
  • 5
  • 15
  • 36
2
votes
3 answers

using boost::iostreams to read specifically crafted data, then based on that create object and append it to list

I have an interesting problem. Let's say that i have file with lines filled like this: name1[xp,y,z321](a,b,c){text};//comment #comment name2(aaaa); also I have (simplified) class: class something { public: something(const std::string& name); …
Johnny_Bit
  • 21
  • 1
2
votes
0 answers

Should I implement this as a Sink or an OutputFilter with boost::iostreams?

I use a boost::iostreams::filtering_ostream to write debug logs for my application. I want to improve my debug logging by keeping the last 100 or so entries and saving them to a file in the event of a crash. I imagine I can do this in two ways: I…
Elliot Cameron
  • 5,235
  • 2
  • 27
  • 34
2
votes
1 answer

boost iostreams assertion failure

I need to be able to use a single fstream to have platform-independent way of using files. In particular, I need to be able to support file paths with unicode characters on Windows with as minimal intrusion into code to support it as possible. As…
Keith4G
  • 387
  • 2
  • 11
2
votes
1 answer

What is the type of the underlying stream of a boost::iostreams::filtering_stream?

I have this stream that performs decompression using Boost.Iostreams: struct istream_zlib : public boost::iostreams::filtering_stream { istream_zlib(std::istream& in) { …
piwi
  • 5,136
  • 2
  • 24
  • 48
2
votes
1 answer

Boost library iostream::copy not working

#include #include #include #include #include int main() { using namespace std; using namespace boost::iostreams; …
Young Hyun Yoo
  • 598
  • 10
  • 21
2
votes
4 answers

Efficient parsing of mmap file

Following is the code for creating a memory map file using boost. boost::iostreams::mapped_file_source file; boost::iostreams::mapped_file_params param; param.path = "\\..\\points.pts"; //! Filepath file.open(param, fileSize); …
Atul
  • 501
  • 1
  • 5
  • 17
2
votes
1 answer

How to access chunk of memory from memory mapped file using boost?

I am trying to read a large file in x,y,z. Typically it runs into gbs of data. I have created memory mapped file using Boost. However, I am still not very clear as how to access a chunk of memory from this file. Boost provides function char* data()…
Atul
  • 501
  • 1
  • 5
  • 17
2
votes
0 answers

how to decompress data to a dynamically allocated memory location

Basically I am trying to decompress some source to the dynamically allocation memory pointed by data pointer. I have following code, I can see copy() is working, but data pointed memory is all 0s. does anyone know why? void *data = new…
JustDance
  • 61
  • 1
  • 5
2
votes
2 answers

boost::iostreams::stream does not set EOF

Sample: namespace boostio = boost::iostreams; boostio::stream memStream(arr); while (!memStream.eof()) { char tst[2]; memStream2.readsome(tst, 2); } Here I initialize memstream with an char array, but the while…
Gmt
  • 569
  • 1
  • 5
  • 19