How to update a printed message in terminal without reprintingHow to update a output field in terminal without output a new line?Output multiple chacters to the same location in the Windows command console without overwritingC++ Update console outputDisplay a single line to stdout that updates a portion instead of printing a new line in Ctext being rewritten for 1000 times?Modify text already in the terminalProgressbar C++How would I overwrite a printed 2D array to simulate 'updates'How to print colored text in terminal in Python?How do I reload .bashrc without logging out and back in?How do I output coloured text to a Linux terminal?Printing to a progress bar to the terminal from Java/C++How do I clear/delete the current line in terminal?Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionHow to update a output field in terminal without output a new line?How to get the current date and time in the terminal and set a custom command in terminal for it?Linux Printing - How ToCommand line progress bar with other output
Why does it output Integers instead of letters?
Changing trains in the Netherlands
If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?
Keep milk (or milk alternative) for a day without a fridge
How many hours would it take to watch all of Doctor Who?
Why isn't pressure filtration popular compared to vacuum filtration?
Terry Pratchett book with a lawyer dragon and sheep
How can I effectively communicate to recruiters that a phone call is not possible?
Storming Area 51
Is a bass line the same as a bass note progression?
The monorail explodes before I can get on it
How to wire 3 hots / 3 neutrals into this new TR outlet with 2 screws?
How do you glue a text to a point?
Matchmaker, Matchmaker, make me a match
Machine learning and operations research projects
Are randomly-generated passwords starting with "a" less secure?
How would vampires avoid contracting diseases?
How can one write good dialogue in a story without sounding wooden?
Why do players in the past play much longer tournaments than today's top players?
Does Lufthansa weigh your carry on luggage?
Do you know your 'KVZ's?
Why didn't Thanos kill all the Dwarves on Nidavellir?
Is the genetic term "polycistronic" still used in modern biology?
RPI3B+: What are the four components below the HDMI connector called?
How to update a printed message in terminal without reprinting
How to update a output field in terminal without output a new line?Output multiple chacters to the same location in the Windows command console without overwritingC++ Update console outputDisplay a single line to stdout that updates a portion instead of printing a new line in Ctext being rewritten for 1000 times?Modify text already in the terminalProgressbar C++How would I overwrite a printed 2D array to simulate 'updates'How to print colored text in terminal in Python?How do I reload .bashrc without logging out and back in?How do I output coloured text to a Linux terminal?Printing to a progress bar to the terminal from Java/C++How do I clear/delete the current line in terminal?Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionHow to update a output field in terminal without output a new line?How to get the current date and time in the terminal and set a custom command in terminal for it?Linux Printing - How ToCommand line progress bar with other output
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to make a progress bar for my terminal application that would work something like:
[XXXXXXX ]
which would give a visual indication of how much time there is left before the process completes.
I know I can do something like printing more and more X's by adding them to the string and then simply printf, but that would look like:
[XXXXXXX ]
[XXXXXXXX ]
[XXXXXXXXX ]
[XXXXXXXXXX ]
or something like that (obviously you can play with the spacing.) But this is not visually aesthetic. Is there a way to update the printed text in a terminal with new text without reprinting? This is all under linux, c++.
c++ linux text terminal
add a comment |
I want to make a progress bar for my terminal application that would work something like:
[XXXXXXX ]
which would give a visual indication of how much time there is left before the process completes.
I know I can do something like printing more and more X's by adding them to the string and then simply printf, but that would look like:
[XXXXXXX ]
[XXXXXXXX ]
[XXXXXXXXX ]
[XXXXXXXXXX ]
or something like that (obviously you can play with the spacing.) But this is not visually aesthetic. Is there a way to update the printed text in a terminal with new text without reprinting? This is all under linux, c++.
c++ linux text terminal
add a comment |
I want to make a progress bar for my terminal application that would work something like:
[XXXXXXX ]
which would give a visual indication of how much time there is left before the process completes.
I know I can do something like printing more and more X's by adding them to the string and then simply printf, but that would look like:
[XXXXXXX ]
[XXXXXXXX ]
[XXXXXXXXX ]
[XXXXXXXXXX ]
or something like that (obviously you can play with the spacing.) But this is not visually aesthetic. Is there a way to update the printed text in a terminal with new text without reprinting? This is all under linux, c++.
c++ linux text terminal
I want to make a progress bar for my terminal application that would work something like:
[XXXXXXX ]
which would give a visual indication of how much time there is left before the process completes.
I know I can do something like printing more and more X's by adding them to the string and then simply printf, but that would look like:
[XXXXXXX ]
[XXXXXXXX ]
[XXXXXXXXX ]
[XXXXXXXXXX ]
or something like that (obviously you can play with the spacing.) But this is not visually aesthetic. Is there a way to update the printed text in a terminal with new text without reprinting? This is all under linux, c++.
c++ linux text terminal
c++ linux text terminal
edited Mar 26 at 2:30
jww
56.3k42 gold badges249 silver badges540 bronze badges
56.3k42 gold badges249 silver badges540 bronze badges
asked Aug 26 '09 at 21:14
ldogldog
6,6738 gold badges45 silver badges65 bronze badges
6,6738 gold badges45 silver badges65 bronze badges
add a comment |
add a comment |
8 Answers
8
active
oldest
votes
try using r
instead of n
when printing the new "version".
for(int i=0;i<=100;++i) printf("r[%3d%%]",i);
printf("n");
works like a charm, thanks
– ldog
Aug 26 '09 at 21:32
add a comment |
I'd say that a library like ncurses would be used to such things. curses helps move the cursor around the screen and draw text and such.
NCurses
6
Sounds like an overkill here.
– Michael Krelin - hacker
Aug 26 '09 at 21:20
1
Yeah, probably...just a suggestion if someone wants to get more fancy in the future ;)
– KFro
Aug 26 '09 at 21:23
3
Yeah... there could be a game of PONG going on while we wait for the progress bar. :D
– kjfletch
Aug 26 '09 at 21:30
thanks for the tip ;) I know about ncurses, I've used it before to make a terminal hangman game, but I wanted to ask around before using it cause I knew it was overkill
– ldog
Aug 26 '09 at 21:33
add a comment |
Something like this:
std::stringstream out;
for (int i = 0; i< 10; i++)
out << "X";
cout << "r" << "[" << out.str() << "]";
The sneaky bit is the carriage return character "r" which causes the cursor to move to the start of the line without going down to the next line.
add a comment |
Others have already pointed out that you can use r
to go back to the beginning of the current line, and overwrite the entire line.
Another possibility is to use the backspace character ("b") to erase a few spaces, and overwrite only those spaces. This can have a couple of advantages. First, it obviously avoids having to regenerate everything in the line, which can sometimes be mildly painful (though that is fairly unusual). Second, it can avoid some pain in displaying data that (for one example) shrinks in size as you write it -- for example, if you're displaying a count-down from 100 to 0, with r
you have to be careful about overwriting the entire previous length, or your countdown will go from (for example) 100 to 990 (i.e., leaving the previous "0" intact).
Note, however, that while back-space within a line normally works, a backspace at the beginning of a line may or may not move the cursor/write position back to a previous line. For most practical purposes, you can only move around within a single line.
add a comment |
'r' will perform a carriage return. Imagine a printer doing a carriage return without a linefeed ('n'). This will return the writing point back to the start of the line... then reprint your updated status on top of the original line.
add a comment |
It's a different language, but this question might be of assistance to you. Basically, the escape character r (carriage Return, as opposed to n Newline) moves you back to the beginning of your current printed line so you can overwrite what you've already printed.
add a comment |
Another option is to simply print one character at a time. Typically, stdout is line buffered, so you'll need to call fflush(stdout) --
for(int i = 0; i < 50; ++i)
putchar('X'); fflush(stdout);
/* do some stuff here */
putchar('n');
But this doesn't have the nice terminating "]" that indicates completion.
add a comment |
I've written this loading bar utility some time ago. Might be useful...
https://github.com/BlaDrzz/CppUtility/tree/master/LoadingBar
You can customise basically anything in here.
int max = 1000;
LoadingBar* lb = new LoadingBar(10, 0, max);
for (size_t i = 0; i <= max; i++)
lb->print();
lb->iterate();
cout << lb->toString() << endl;
Very simple and customisable implementation..
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1337529%2fhow-to-update-a-printed-message-in-terminal-without-reprinting%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
try using r
instead of n
when printing the new "version".
for(int i=0;i<=100;++i) printf("r[%3d%%]",i);
printf("n");
works like a charm, thanks
– ldog
Aug 26 '09 at 21:32
add a comment |
try using r
instead of n
when printing the new "version".
for(int i=0;i<=100;++i) printf("r[%3d%%]",i);
printf("n");
works like a charm, thanks
– ldog
Aug 26 '09 at 21:32
add a comment |
try using r
instead of n
when printing the new "version".
for(int i=0;i<=100;++i) printf("r[%3d%%]",i);
printf("n");
try using r
instead of n
when printing the new "version".
for(int i=0;i<=100;++i) printf("r[%3d%%]",i);
printf("n");
answered Aug 26 '09 at 21:17
Michael Krelin - hackerMichael Krelin - hacker
95.3k14 gold badges167 silver badges157 bronze badges
95.3k14 gold badges167 silver badges157 bronze badges
works like a charm, thanks
– ldog
Aug 26 '09 at 21:32
add a comment |
works like a charm, thanks
– ldog
Aug 26 '09 at 21:32
works like a charm, thanks
– ldog
Aug 26 '09 at 21:32
works like a charm, thanks
– ldog
Aug 26 '09 at 21:32
add a comment |
I'd say that a library like ncurses would be used to such things. curses helps move the cursor around the screen and draw text and such.
NCurses
6
Sounds like an overkill here.
– Michael Krelin - hacker
Aug 26 '09 at 21:20
1
Yeah, probably...just a suggestion if someone wants to get more fancy in the future ;)
– KFro
Aug 26 '09 at 21:23
3
Yeah... there could be a game of PONG going on while we wait for the progress bar. :D
– kjfletch
Aug 26 '09 at 21:30
thanks for the tip ;) I know about ncurses, I've used it before to make a terminal hangman game, but I wanted to ask around before using it cause I knew it was overkill
– ldog
Aug 26 '09 at 21:33
add a comment |
I'd say that a library like ncurses would be used to such things. curses helps move the cursor around the screen and draw text and such.
NCurses
6
Sounds like an overkill here.
– Michael Krelin - hacker
Aug 26 '09 at 21:20
1
Yeah, probably...just a suggestion if someone wants to get more fancy in the future ;)
– KFro
Aug 26 '09 at 21:23
3
Yeah... there could be a game of PONG going on while we wait for the progress bar. :D
– kjfletch
Aug 26 '09 at 21:30
thanks for the tip ;) I know about ncurses, I've used it before to make a terminal hangman game, but I wanted to ask around before using it cause I knew it was overkill
– ldog
Aug 26 '09 at 21:33
add a comment |
I'd say that a library like ncurses would be used to such things. curses helps move the cursor around the screen and draw text and such.
NCurses
I'd say that a library like ncurses would be used to such things. curses helps move the cursor around the screen and draw text and such.
NCurses
answered Aug 26 '09 at 21:19
KFroKFro
6993 silver badges8 bronze badges
6993 silver badges8 bronze badges
6
Sounds like an overkill here.
– Michael Krelin - hacker
Aug 26 '09 at 21:20
1
Yeah, probably...just a suggestion if someone wants to get more fancy in the future ;)
– KFro
Aug 26 '09 at 21:23
3
Yeah... there could be a game of PONG going on while we wait for the progress bar. :D
– kjfletch
Aug 26 '09 at 21:30
thanks for the tip ;) I know about ncurses, I've used it before to make a terminal hangman game, but I wanted to ask around before using it cause I knew it was overkill
– ldog
Aug 26 '09 at 21:33
add a comment |
6
Sounds like an overkill here.
– Michael Krelin - hacker
Aug 26 '09 at 21:20
1
Yeah, probably...just a suggestion if someone wants to get more fancy in the future ;)
– KFro
Aug 26 '09 at 21:23
3
Yeah... there could be a game of PONG going on while we wait for the progress bar. :D
– kjfletch
Aug 26 '09 at 21:30
thanks for the tip ;) I know about ncurses, I've used it before to make a terminal hangman game, but I wanted to ask around before using it cause I knew it was overkill
– ldog
Aug 26 '09 at 21:33
6
6
Sounds like an overkill here.
– Michael Krelin - hacker
Aug 26 '09 at 21:20
Sounds like an overkill here.
– Michael Krelin - hacker
Aug 26 '09 at 21:20
1
1
Yeah, probably...just a suggestion if someone wants to get more fancy in the future ;)
– KFro
Aug 26 '09 at 21:23
Yeah, probably...just a suggestion if someone wants to get more fancy in the future ;)
– KFro
Aug 26 '09 at 21:23
3
3
Yeah... there could be a game of PONG going on while we wait for the progress bar. :D
– kjfletch
Aug 26 '09 at 21:30
Yeah... there could be a game of PONG going on while we wait for the progress bar. :D
– kjfletch
Aug 26 '09 at 21:30
thanks for the tip ;) I know about ncurses, I've used it before to make a terminal hangman game, but I wanted to ask around before using it cause I knew it was overkill
– ldog
Aug 26 '09 at 21:33
thanks for the tip ;) I know about ncurses, I've used it before to make a terminal hangman game, but I wanted to ask around before using it cause I knew it was overkill
– ldog
Aug 26 '09 at 21:33
add a comment |
Something like this:
std::stringstream out;
for (int i = 0; i< 10; i++)
out << "X";
cout << "r" << "[" << out.str() << "]";
The sneaky bit is the carriage return character "r" which causes the cursor to move to the start of the line without going down to the next line.
add a comment |
Something like this:
std::stringstream out;
for (int i = 0; i< 10; i++)
out << "X";
cout << "r" << "[" << out.str() << "]";
The sneaky bit is the carriage return character "r" which causes the cursor to move to the start of the line without going down to the next line.
add a comment |
Something like this:
std::stringstream out;
for (int i = 0; i< 10; i++)
out << "X";
cout << "r" << "[" << out.str() << "]";
The sneaky bit is the carriage return character "r" which causes the cursor to move to the start of the line without going down to the next line.
Something like this:
std::stringstream out;
for (int i = 0; i< 10; i++)
out << "X";
cout << "r" << "[" << out.str() << "]";
The sneaky bit is the carriage return character "r" which causes the cursor to move to the start of the line without going down to the next line.
answered Aug 26 '09 at 21:19
1800 INFORMATION1800 INFORMATION
102k24 gold badges139 silver badges226 bronze badges
102k24 gold badges139 silver badges226 bronze badges
add a comment |
add a comment |
Others have already pointed out that you can use r
to go back to the beginning of the current line, and overwrite the entire line.
Another possibility is to use the backspace character ("b") to erase a few spaces, and overwrite only those spaces. This can have a couple of advantages. First, it obviously avoids having to regenerate everything in the line, which can sometimes be mildly painful (though that is fairly unusual). Second, it can avoid some pain in displaying data that (for one example) shrinks in size as you write it -- for example, if you're displaying a count-down from 100 to 0, with r
you have to be careful about overwriting the entire previous length, or your countdown will go from (for example) 100 to 990 (i.e., leaving the previous "0" intact).
Note, however, that while back-space within a line normally works, a backspace at the beginning of a line may or may not move the cursor/write position back to a previous line. For most practical purposes, you can only move around within a single line.
add a comment |
Others have already pointed out that you can use r
to go back to the beginning of the current line, and overwrite the entire line.
Another possibility is to use the backspace character ("b") to erase a few spaces, and overwrite only those spaces. This can have a couple of advantages. First, it obviously avoids having to regenerate everything in the line, which can sometimes be mildly painful (though that is fairly unusual). Second, it can avoid some pain in displaying data that (for one example) shrinks in size as you write it -- for example, if you're displaying a count-down from 100 to 0, with r
you have to be careful about overwriting the entire previous length, or your countdown will go from (for example) 100 to 990 (i.e., leaving the previous "0" intact).
Note, however, that while back-space within a line normally works, a backspace at the beginning of a line may or may not move the cursor/write position back to a previous line. For most practical purposes, you can only move around within a single line.
add a comment |
Others have already pointed out that you can use r
to go back to the beginning of the current line, and overwrite the entire line.
Another possibility is to use the backspace character ("b") to erase a few spaces, and overwrite only those spaces. This can have a couple of advantages. First, it obviously avoids having to regenerate everything in the line, which can sometimes be mildly painful (though that is fairly unusual). Second, it can avoid some pain in displaying data that (for one example) shrinks in size as you write it -- for example, if you're displaying a count-down from 100 to 0, with r
you have to be careful about overwriting the entire previous length, or your countdown will go from (for example) 100 to 990 (i.e., leaving the previous "0" intact).
Note, however, that while back-space within a line normally works, a backspace at the beginning of a line may or may not move the cursor/write position back to a previous line. For most practical purposes, you can only move around within a single line.
Others have already pointed out that you can use r
to go back to the beginning of the current line, and overwrite the entire line.
Another possibility is to use the backspace character ("b") to erase a few spaces, and overwrite only those spaces. This can have a couple of advantages. First, it obviously avoids having to regenerate everything in the line, which can sometimes be mildly painful (though that is fairly unusual). Second, it can avoid some pain in displaying data that (for one example) shrinks in size as you write it -- for example, if you're displaying a count-down from 100 to 0, with r
you have to be careful about overwriting the entire previous length, or your countdown will go from (for example) 100 to 990 (i.e., leaving the previous "0" intact).
Note, however, that while back-space within a line normally works, a backspace at the beginning of a line may or may not move the cursor/write position back to a previous line. For most practical purposes, you can only move around within a single line.
answered Jun 11 '12 at 15:57
Jerry CoffinJerry Coffin
395k57 gold badges490 silver badges933 bronze badges
395k57 gold badges490 silver badges933 bronze badges
add a comment |
add a comment |
'r' will perform a carriage return. Imagine a printer doing a carriage return without a linefeed ('n'). This will return the writing point back to the start of the line... then reprint your updated status on top of the original line.
add a comment |
'r' will perform a carriage return. Imagine a printer doing a carriage return without a linefeed ('n'). This will return the writing point back to the start of the line... then reprint your updated status on top of the original line.
add a comment |
'r' will perform a carriage return. Imagine a printer doing a carriage return without a linefeed ('n'). This will return the writing point back to the start of the line... then reprint your updated status on top of the original line.
'r' will perform a carriage return. Imagine a printer doing a carriage return without a linefeed ('n'). This will return the writing point back to the start of the line... then reprint your updated status on top of the original line.
answered Aug 26 '09 at 21:20
kjfletchkjfletch
4,3631 gold badge27 silver badges33 bronze badges
4,3631 gold badge27 silver badges33 bronze badges
add a comment |
add a comment |
It's a different language, but this question might be of assistance to you. Basically, the escape character r (carriage Return, as opposed to n Newline) moves you back to the beginning of your current printed line so you can overwrite what you've already printed.
add a comment |
It's a different language, but this question might be of assistance to you. Basically, the escape character r (carriage Return, as opposed to n Newline) moves you back to the beginning of your current printed line so you can overwrite what you've already printed.
add a comment |
It's a different language, but this question might be of assistance to you. Basically, the escape character r (carriage Return, as opposed to n Newline) moves you back to the beginning of your current printed line so you can overwrite what you've already printed.
It's a different language, but this question might be of assistance to you. Basically, the escape character r (carriage Return, as opposed to n Newline) moves you back to the beginning of your current printed line so you can overwrite what you've already printed.
edited May 23 '17 at 12:32
Community♦
11 silver badge
11 silver badge
answered Aug 26 '09 at 21:20
TimTim
52.9k16 gold badges145 silver badges154 bronze badges
52.9k16 gold badges145 silver badges154 bronze badges
add a comment |
add a comment |
Another option is to simply print one character at a time. Typically, stdout is line buffered, so you'll need to call fflush(stdout) --
for(int i = 0; i < 50; ++i)
putchar('X'); fflush(stdout);
/* do some stuff here */
putchar('n');
But this doesn't have the nice terminating "]" that indicates completion.
add a comment |
Another option is to simply print one character at a time. Typically, stdout is line buffered, so you'll need to call fflush(stdout) --
for(int i = 0; i < 50; ++i)
putchar('X'); fflush(stdout);
/* do some stuff here */
putchar('n');
But this doesn't have the nice terminating "]" that indicates completion.
add a comment |
Another option is to simply print one character at a time. Typically, stdout is line buffered, so you'll need to call fflush(stdout) --
for(int i = 0; i < 50; ++i)
putchar('X'); fflush(stdout);
/* do some stuff here */
putchar('n');
But this doesn't have the nice terminating "]" that indicates completion.
Another option is to simply print one character at a time. Typically, stdout is line buffered, so you'll need to call fflush(stdout) --
for(int i = 0; i < 50; ++i)
putchar('X'); fflush(stdout);
/* do some stuff here */
putchar('n');
But this doesn't have the nice terminating "]" that indicates completion.
answered Aug 26 '09 at 22:30
NVRAMNVRAM
4,5787 gold badges34 silver badges43 bronze badges
4,5787 gold badges34 silver badges43 bronze badges
add a comment |
add a comment |
I've written this loading bar utility some time ago. Might be useful...
https://github.com/BlaDrzz/CppUtility/tree/master/LoadingBar
You can customise basically anything in here.
int max = 1000;
LoadingBar* lb = new LoadingBar(10, 0, max);
for (size_t i = 0; i <= max; i++)
lb->print();
lb->iterate();
cout << lb->toString() << endl;
Very simple and customisable implementation..
add a comment |
I've written this loading bar utility some time ago. Might be useful...
https://github.com/BlaDrzz/CppUtility/tree/master/LoadingBar
You can customise basically anything in here.
int max = 1000;
LoadingBar* lb = new LoadingBar(10, 0, max);
for (size_t i = 0; i <= max; i++)
lb->print();
lb->iterate();
cout << lb->toString() << endl;
Very simple and customisable implementation..
add a comment |
I've written this loading bar utility some time ago. Might be useful...
https://github.com/BlaDrzz/CppUtility/tree/master/LoadingBar
You can customise basically anything in here.
int max = 1000;
LoadingBar* lb = new LoadingBar(10, 0, max);
for (size_t i = 0; i <= max; i++)
lb->print();
lb->iterate();
cout << lb->toString() << endl;
Very simple and customisable implementation..
I've written this loading bar utility some time ago. Might be useful...
https://github.com/BlaDrzz/CppUtility/tree/master/LoadingBar
You can customise basically anything in here.
int max = 1000;
LoadingBar* lb = new LoadingBar(10, 0, max);
for (size_t i = 0; i <= max; i++)
lb->print();
lb->iterate();
cout << lb->toString() << endl;
Very simple and customisable implementation..
answered May 24 '18 at 12:38
BlaDrzzBlaDrzz
53 bronze badges
53 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1337529%2fhow-to-update-a-printed-message-in-terminal-without-reprinting%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown