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.
Asked
Active
Viewed 536 times
0
-
I'm sure you can tag it a little better. C++ ? – karlphillip Dec 11 '10 at 14:38
-
Sorry, I was trying to think of tags to tag it with and got stumped. Fixed. – Jookia Dec 11 '10 at 14:39
-
Do you mean that you don't want it to be flushed, or that you want it to be flushed without being told? – Beta Dec 11 '10 at 15:03
1 Answers
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.
-
You didn't have a code snippet of it, so I didn't quite understand what you meant. – Jookia Dec 11 '10 at 15:23