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

insert a string in front of a istream in cpp

My problem is something like I want to append some string in front of a iostream. You can say in front of std::cin. #include #include void print(std::istream & in){// function not to be modified std::string str; in >>…
keen_learner
  • 211
  • 4
  • 8
4
votes
2 answers

Convert C *FILE to C++ iostream with boost

I am fairly new to C++ and wanted to convert a *FILE (such as returned by popen()) to a iostream to be used with functions such as getline etc. I found the following code…
Simon Streicher
  • 2,638
  • 1
  • 26
  • 30
4
votes
1 answer

How to get boost::iostream to operate in a mode comparable to std::ios::binary?

I have the following question on boost::iostreams. If someone is familiar with writing filters, I would actually appreciate your advices / help. I am writing a pair of multichar filters, that work with boost::iostream::filtering_stream as data…
Yippie-Ki-Yay
  • 22,026
  • 26
  • 90
  • 148
4
votes
3 answers

C++ iostreams question

I am now diving into boost::iostreams and I'm looking for a way to create a stream that iterates over some container. Right now I have the code that work for a std::vector, but it does ONLY for it, because I wrote std::vector-specific…
Yippie-Ki-Yay
  • 22,026
  • 26
  • 90
  • 148
4
votes
2 answers

boost::iostreams::copy - sink - ENOSPC (No space left on device) error handling

In the code fragment below, is there a way to handle ENOSPC? #include #include #include #include #include // open input…
ϹοδεMεδιϲ
  • 2,790
  • 3
  • 33
  • 54
4
votes
1 answer

Boost Iostreams zlib_error with Custom Source

I am trying to use a zlib_decompressor to decompress data through an istreambuf_iterator. I couldn't find an in built way to use an input iterator as input to a stream (please point out a way if one exists already) so I wrote this source: template…
Ell
  • 4,238
  • 6
  • 34
  • 60
4
votes
1 answer

boost iostreams library exist but i am unable link it

I know that the re plenty of similar questions, but mine is litle bit different and non them helped me. I am using boost-iostreams library and here is my problem, i tried to link my program with libraries: ld -I/usr/include/boost/iostreams/…
Addman
  • 341
  • 1
  • 5
  • 13
4
votes
2 answers

Why stringstream::str() truncates string?

I have stringstream object. It is filled through stringstream ss; boost::iostreams::copy(inp,ss); from boost::iostreams::filtering_streambuf inp; and actually holds ungzipped file within. Now if i flush stringstream…
Alexander
  • 779
  • 8
  • 17
4
votes
1 answer

Is there a boost::iostreams (bidirectional) Device for a blocking boost::asio TCP connection?

I'm surveying c++ libraries for portable, blocking I/O access to the filesystem and network. It looks like boost::filesystem, boost::iostreams and boost::asio will, between the three of them, do the job. To be clear, I'm not currently interested in…
phs
  • 10,687
  • 4
  • 58
  • 84
4
votes
4 answers

extracting compressed file with boost::iostreams

I'm searching for a way to extract a file in c++ by using the boost::iostreams classes. There is an example in the boost documentation. But it outputs the content of the compressed file to std::cout. I'm looking for a way to extract it to a file…
Pieter Hoste
  • 587
  • 2
  • 8
  • 22
4
votes
1 answer

Using boost::iostreams mapped_file_source and filtering_streambuf to decompress file

I plan to process large compressed files and I would like to memory map the files to speedup reading. I adopted the existing example with regular file input but cannot get it either compile nor work :-) I'm using C++ Boost 1.49 Any suggestion…
G. Civardi
  • 667
  • 5
  • 12
3
votes
2 answers

How can I decompress a vector of deflated data with Boost?

I have a vector that contains zlib-compressed (deflated) data. I would like to decompress it with Boost's filtering_istream. There is only one example on their site, which operates on a stream of data (as opposed to a vector that I have).…
Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180
3
votes
3 answers

Using boost::iostreams::mapped_file_source with wide character strings

If I instantiate a mapped_file_source (boost 1.46.1 ) with a narrow character string as in the following I don't have a problem: boost::iostreams::mapped_file_source m_file_( "testfile.txt" ); However if I try to use a wide…
3
votes
1 answer

Switching between compressed and uncompressed data

I wrote a simple filter for Boost iostreams that detects if the file is compressed or simple text and would delegate to the gzip_decompressor if it is. The problem is that I seek back in my input stream to feed the data again inside the…
Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
3
votes
2 answers

How to prevent zip bomb by boost::iostream

I wrote some code like this: std::vector unzip(std::vector const& compressed) { std::vector decompressed; boost::iostreams::filtering_ostream os; os.push(boost::iostreams::gzip_decompressor()); …
alpha
  • 1,228
  • 1
  • 11
  • 26
1 2
3
10 11