Refresh written text in console?
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
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement