0

Currently I create an ostream with a custom stringbuf derived object, but it uses sync() to print text on the screen. Is there a way to avoid having to flush it? I really want to do logStream << "Test"; without std::flush or endl.

Jookia
  • 6,544
  • 13
  • 50
  • 60

1 Answers1

1

See my answer to this related question: Custom stream to method in C++?

All you really need to change is to add the flush instead of the function call and your stream instead of the stringstream.

Edit: Just saw that was your question. The answer still works though.

Community
  • 1
  • 1
ltjax
  • 15,837
  • 3
  • 39
  • 62