feelfree
feelfree

Reputation: 11753

Difference between std::fstream and Boost Iostreams Library

I am a newbie of BOOST library. Today I saw a small code segment, where reading and writing a PGM format image was implemented with Boost Iostreams Library. As I am more familiar with STL, I can easily tell that std::fstream can do the same job. Then my question is, what's the point of using Boost library in such a simple reading and writing PGM image application? Moreover, I was wondering in which situation BOOST Iostreams Library is most needed. Thanks!

Upvotes: 4

Views: 3769

Answers (1)

Igor R.
Igor R.

Reputation: 15075

From std::fstream reference:

fstream provides an interface to read and write data from files as input/output streams.

From Boost.Iostreams reference:

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.

Upvotes: 2

Related Questions