Sign in to follow this  
Decrius

Refresh written text in console?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Thanks for the reply's :), I'll need to refresh really often, so I'll use the SetconsoleCursorPosition function. Thank you :D

Decrius

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this