Refresh written text in console?

Started by
2 comments, last by Decrius 17 years, 11 months ago
Hi all, I'm programming in C. Its a console application. I want the program to count something, but I don't want the console to write a new number, no: I want that the program will _overwrite_ the number he wrote before. So it will be something like a counter. I saw a console application doing something like that, I was wondering how :). Thanks for any help :) Decrius
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
Advertisement
I bet your best bet is using this, assuming you're using Windows. SetconsoleCursorPosition might be what you're looking for. Ex, move to 0,0, print " 0%", then move back to 0,0, print " 1%", etc...

Hope this helps
You can also write a return ('\r') without a newline, and write the string with some spaces added. The cursor will flicker all over the thing though, so don't update too fast.
Thanks for the reply's :), I'll need to refresh really often, so I'll use the SetconsoleCursorPosition function. Thank you :D

Decrius
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora

This topic is closed to new replies.

Advertisement