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

warning message RTTI symbol not found when using boost::iostreams

I use Boost::iostreams to write simultaneously to my console and a file. When i use eclipse to debug(with gdb of course), i receive a warning which says RTTI symbol not found for one of the classes that i am using from Boost::iostreams. Here is the…
hAcKnRoCk
  • 1,118
  • 3
  • 16
  • 30
7
votes
1 answer

How to read a file into unsigned char array from std::ifstream?

So normaly I do stuff like: std::ifstream stream; int buff_length = 8192; boost::shared_array buffer( new char[buff_length]); stream.open( path.string().c_str(), std::ios_base::binary); while (stream) { …
myWallJSON
  • 9,110
  • 22
  • 78
  • 149
6
votes
2 answers

Can boost iostreams read and compress gzipped files on the fly?

I am reading a gzipped file using boost iostreams: The following works fine: namespace io = boost::iostreams; io::filtering_istream in; in.push(boost::iostreams::basic_gzip_decompressor<>()); in.push(io::file_source("test.gz")); …
ATemp
  • 319
  • 3
  • 10
6
votes
1 answer

boost iostreams with bzip2 built from source on windows

Recently, I spent some time working on getting boost version 1.44.0 built on windows with both iostreams support for both zlib & bzip2 compression filters. For a variety of reasons, it was decided to allow boost to build both zlib & bzip2 libraries…
Nathan Ernst
  • 4,540
  • 25
  • 38
6
votes
1 answer

BOOST.IOstreams: trouble to write to bzip2

Hello I am would like to store my data in to bzip2 file using Boost.IOstreams. void test_bzip() { namespace BI = boost::iostreams; { string fname="test.bz2"; { BI::filtering_stream my_filter; …
Arman
  • 4,566
  • 10
  • 45
  • 66
6
votes
1 answer

Why doesn't std::istream assume ownership over its streambuf?

I am writing some sort of virtual file system library for video-games in the likes of CRI Middleware's ROFS (see Wikipedia). My intention with the library is to provide natural means of accessing the resources of the games I develop, which store…
Gui Prá
  • 5,559
  • 4
  • 34
  • 59
6
votes
0 answers

boost::iostreams::stream thread safety

Can I write to boost::iostreams::stream from multiple threads without synchronization if my sink is thread-safe? class my_sink : boost::iostreams::sink { public: my_sink(param p) {} std::streamsize write(const char_type *s, std::streamsize…
Red User
  • 429
  • 3
  • 9
6
votes
2 answers

Param syntax for substituting boost filtering_stream for std::ofstream

Some basic questions about boost filtering_streams. I have dozens of functions that take a parameter of std::ofstream& void foo(std::ofstream& outStream) { // lots of operations, like this: outStream << "various bits of text"; } void…
SMGreenfield
  • 1,680
  • 19
  • 35
5
votes
0 answers

Why does link-time optimization cause a segmentation fault?

I am using Mingw-w64 v7 and g++ 10.2 on Windows built with the arguments --mode=gcc-10.2.0 --arch=x86_64 --buildroot=/c/mingw-builds/BuildRoot --update-sources --exceptions=seh --threads=posix --enable-languages=c++ --jobs=48 --rt-version=v7. I have…
5
votes
2 answers

Read and write array to compressed file with boost iostreams

I want to write an array to a file, compressing it as I go. Later, I want to read the array from that file, decompressing it as I go. Boost's Iostreams seems like a good way to go, so I built the following code. Unfortunately, the output and input…
Richard
  • 56,349
  • 34
  • 180
  • 251
5
votes
2 answers

Recommendations for a C++ polymorphic, seekable, binary I/O interface

I've been using std::istream and ostream as a polymorphic interface for random-access binary I/O in C++, but it seems suboptimal in numerous ways: 64-bit seeks are non-portable and error-prone due to streampos/streamoff limitations; currently using…
Trevor Robinson
  • 15,694
  • 5
  • 73
  • 72
5
votes
2 answers

Flushing a boost::iostreams::zlib_compressor. How to obtain a "sync flush"?

Is there some magic required to obtain a "zlib sync flush" when using boost::iostreams::zlib_compressor ? Just invoking flush on the filter, or strict_sync on a filtering_ostream containing it doesn't see to do the job (ie I want the compressor to…
timday
  • 24,582
  • 12
  • 83
  • 135
5
votes
1 answer

Spurious errors in Eclipse CDT: boost::iostreams

I have the following code in Eclipse CDT (Juno SR1): #include #include #include #include #include int main() { using…
NPE
  • 486,780
  • 108
  • 951
  • 1,012
5
votes
2 answers

Boost IO Stream and ZLib speed up

I have a large file of data I have compressed with Zlib using boost IOStreams and filtering stream buffers: boost::iostreams::array_source uncompressedArray( reinterpret_cast< const char* >( &uncompressedData[0] ), uncompressedData.size()…
4
votes
1 answer

Boost iostream: how to turn ifstream into memory mapped file?

What I want is simple to open file for reading as memory mapped file - in order to access it with much more speed in future (example: we open file read it to end, wait and read it again and again) Meanwhile I want that file to be modifiable by other…
Rella
  • 65,003
  • 109
  • 363
  • 636
1
2
3
10 11