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
0
votes
1 answer

boost::iostreams::mapped_file_source opens a file that has CJK filename

Assume we have code like this: boost::iostreams::mapped_file_source dev(paFileName.u8string().c_str()); where paFileName is a std::filesystem::path object. On Windows, the internal character in std::filesystem::path is wchar_t, but…
Cody
  • 609
  • 4
  • 21
0
votes
1 answer

Why does boost::basic_array_source give other values than what I have stored with boost::iostreams::back_insert_device?

I am trying to use functions of a library that reads and writes from/to streams. To adapt my data to that library, I wanted to use boost::iostreams from boost 1.77.0. Still, a first very simple example does not work as expected. Why? #include…
Benjamin Bihler
  • 1,612
  • 11
  • 32
0
votes
1 answer

Tried to decompress a zip file into memory with boost,but it doesn't work

I tried to unzip a zip file with boost zlib, but it doesn't work ,my boost version is 1.75 which is binary which is have been built,I tried the code below with VS 2013 CE #include #include #include
Ken
  • 47
  • 6
0
votes
1 answer

How to change read/write method of source/sink device in C++ boost::iostreams?

I'm trying to get familiar with boost::iostream, so in a example program I'm writing, I want to read a text from a file and write it to file. I would use my inherited class from file_source/file_sink as device to read/write. In the read method, my…
DeadSquad
  • 23
  • 5
0
votes
1 answer

build boost::iostreams with zlib

I'm trying to build the following code: #include #include int main(int argc, char* argv[]) { int a = boost::iostreams::zlib::default_compression; std::cout << a; return 0; } With the command: g++…
vamirio-chan
  • 339
  • 1
  • 13
0
votes
0 answers

Linker error when trying to use LZMA in boost::iostreams from MacPorts

I'm trying to write a function that compresses a data buffer and writes it to a file, but I'm having trouble getting it to build properly. The code itself is pretty straightforward: void writeToFile(std::string fileName, const char* buf, size_t…
Adam
  • 53
  • 4
0
votes
1 answer

Closing boost::filtering_stream automatically when a program is aborted

I'd like to use boost::iostreams to compress log files, and hope that the logs are stored successfully in all cases. Can I reset an object of boost::filtering_stream class automatically when a program is aborted by assertion failures? #include…
Han
  • 625
  • 2
  • 7
  • 25
0
votes
0 answers

Boost Gzip chunked data decompose

I'm trying to you boost::iostreams library to decompose gziped data. I do able to do that for simple data. TEST_F(GzipTest, ZipStringChuncks) { using namespace boost::iostreams; string str_part1 { char(0x1f), char(0x8b),…
igor
  • 716
  • 1
  • 9
  • 27
0
votes
1 answer

Exceptions in boost::iostreams::multichar_input_filter disappear when code is compiled with Visual Studio

I'm working on a stream filter that can decode a custom file format. My goal is to use boost::iostreams::filtering_istream to read the file and process it with my boost::iostreams::multichar_input_filter subclass, so that I can load values using the…
awagner
  • 58
  • 4
0
votes
1 answer

Any way to wrap construction of boost "tee" stream for automatic type deduction?

boost::iostreams::tee and company have a bit of a noisy/repetitive usage as seen here: C++ "hello world" Boost tee example program The goal is to make something like: auto myTeeStream = make_tee(std::cout, myfile); After trying to wrap this usage…
Catskul
  • 17,916
  • 15
  • 84
  • 113
0
votes
1 answer

Use of BOOST property_tree / iostreams / filesystem / foreach - results with a Link Error

I try to build a project, utilizing boost/property_tree with Boost xml_parser, upon a std::wstring full_path. But I get a link error (See below). #include // C++17 #include // C++11 #include…
Amit G.
  • 2,546
  • 2
  • 22
  • 30
0
votes
1 answer

Copying file content to a container not type of char?

I have an disrupive issue with my code. I'm using boost iostreams library to copy file content to a vector which is provided by other component of a system thus I'm unable to change type of this container. I have solved this problem by creating a…
0
votes
1 answer

Crash if I try to copy uncompressed filtering_istream to stringstream

I want to uncompress a file and write its content into a stringstream. This is the code I tried: string readGZipLog () { try { using namespace boost::iostreams; ifstream file(currentFile.c_str(), std::ios_base::in |…
Paul
  • 1,295
  • 2
  • 11
  • 26
0
votes
1 answer

Trying to access source device from boost::iostreams

I wrote a custom source device that counts the bytes read so far: class socket_stream_source : public boost::iostreams::source { public: int readSoFar=0; socket_stream_source(socket_ptr sock) : _sock(sock) { } std::streamsize…
Ray Hulha
  • 10,701
  • 5
  • 53
  • 53
0
votes
0 answers

Boost iostreams long time to open memory mapped file

When I call open on a boost::iostreams::mapped_file_source my program hangs for around two minutes. I tried attaching gdb to the process at this point and the backtrace shows (gdb) backtrace #0 0x00007f779226687a in mmap64 () at…
k-r
  • 11
  • 3
1 2 3
10
11