1

I have a class that contains decoded video frames. I would like my decoder to use an output_iterator to write those frames to different targets. In order to support writing directly to a file, I want to overload operator << for my decoded frame class (for use with ostream_iterator). The problem is, that operator << is meant to be used for formatted output, but I want to do unformatted output with it. Are there any pitfalls to be considered? Is there another solution, or is it OK to just go with that?

Björn Pollex
  • 75,346
  • 28
  • 201
  • 283

2 Answers2

1

std::basic_ostream is indeed mainly to be used for formatted output. (I say "mainly" because it does have a method for unformatted output. But that's not accessible through output iterators.) For unformatted output, use a stream buffer iterator.

sbi
  • 219,715
  • 46
  • 258
  • 445
0

use the unformatted out put function like getchar, fgets

satyam
  • 123
  • 1
  • 7