Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I overwrite the same portion of the console in a Windows native C++ console app, without using a 3rd Party library?

Tags:

I have a console app that needs to display the state of items, but rather than having text scroll by like mad I'd rather see the current status keep showing up on the same lines. For the sake of example:

Running... nn% complete
Buffer size: bbbb bytes

should be the output, where 'nn' is the current percentage complete, and 'bbbb' is a buffer size, updated periodically on the same lines of the console.

The first approach I took simply printed the correct number of backspaces to the console before printing the new state, but this has an obnoxious flicker that I want to get rid of. I also want to stick to either standard library or MS-provided functionality (VC 8) so as not to introduce another dependency for this one simple need.