List244
asked on
Force Buffer Usage cout
Hi, how can I set my cout statements to a forced buffer?
In other words, how can I stop it from drawing until flushed?
In other words, how can I stop it from drawing until flushed?
BTW, an 'ostringstream' might be suitable even better, e.g.
ostringstream oss;
oss << "Some text " << endl << "Some integer value " << 42 << " floating point " << 3.141 << endl;
// ... more
// and finally:
cout << oss.str();
ostringstream oss;
oss << "Some text " << endl << "Some integer value " << 42 << " floating point " << 3.141 << endl;
// ... more
// and finally:
cout << oss.str();
ASKER
The problem with that is my values are not normal. I am using colored values which draw to the screen
and pretty much what I would like to do is clear out a little of the blinking when redrawing.
and pretty much what I would like to do is clear out a little of the blinking when redrawing.
That should work even for control characters. By 'buffering' the output, you'll write that when your done with all the formatting and the output, so you should get rid of the problem that way.
ASKER
My output has so many colors though, it would almost be the same. Because I would have to buffer a single character and
then print. My actual draw routine does not give too much flicker, my problem is when I clear and redraw. My main problem
is I would like this clear function(self-written not system("cls")) not to register until it has been redrawn.
I could modify the clear function not to clear those areas in which will be drawn to pretty easily, but I was just curious if I could just
stop output until I was ready instead.
then print. My actual draw routine does not give too much flicker, my problem is when I clear and redraw. My main problem
is I would like this clear function(self-written not system("cls")) not to register until it has been redrawn.
I could modify the clear function not to clear those areas in which will be drawn to pretty easily, but I was just curious if I could just
stop output until I was ready instead.
>>Because I would have to buffer a single character and then print.
How are you doing the 'color thing' exactly at the moment?
How are you doing the 'color thing' exactly at the moment?
ASKER
I am using SetConsoleTextAttribute, then I am printing out the character.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Make "to activate that one to complete the flicker and blinking completely" read "to activate that one to eliminate the flicker and blinking completely" *grmpf* ;o)
ASKER
Haha, I knew what you meant, just give me a little while so I can actually try it out and see how it works.
I should be able to get to it tomorrow.
I should be able to get to it tomorrow.
Take you time, I just re-read it and simply didn't like it *g*
#include <iostream>
#include <sstream>
using namespace std;
//...
stringstream ss;
ss << "Some text " << endl << "Some integer value " << 42 << " floating point " << 3.141 << endl;
// ... more
// and finally:
cout << ss.str();