-
May 10th, 2009, 04:45 PM
#1
Erasing multiple lines in Windows console
Hi everyone,
I have created a Win32 console application. I would like to give the user an indication of the program's progress because my program runs for a long time. I also have multiple progress indicators. However, if I put things on different lines, I can only erase the last line. For example, I want to output this to the user:
And I want to keep updating this. But when I try to use \b to erase both of the lines, it only erases the last line. So if I put (cout << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b" << attempts << endl << progress), it prints out:
Code:
3 attempts
4 attempts
46%
How do I erase the first line?
Thanks.
-
May 10th, 2009, 09:18 PM
#2
Re: Erasing multiple lines in Windows console
-
May 10th, 2009, 10:32 PM
#3
Re: Erasing multiple lines in Windows console
I'm sure you can do that using the functions SetConsoleCursorPosition and WriteConsole.
-
May 10th, 2009, 11:36 PM
#4
Re: Erasing multiple lines in Windows console
Originally Posted by Mybowlcut
Obviously, I tried searching this up on Google and I found nothing that said anything about erasing multiple lines of text.
-
May 11th, 2009, 12:14 AM
#5
Re: Erasing multiple lines in Windows console
Obviously, You did not try hard enough. Here is good start. Play close attention to SetConsoleCursorPosition function. From this, it should be easy to come up with solution to your problem.
-
May 11th, 2009, 12:18 AM
#6
Re: Erasing multiple lines in Windows console
The third result down explains exactly the task that you are trying to do...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|