Jump to content
  • Advertisement
Sign in to follow this  
Decrius

Refresh written text in console?

This topic is 4432 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!