I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this:
[======> ] 37%
and of course the loading bar moves and the percent changes, But it doesn’t make a new line. I cannot figure out how to do this. Can someone point me in the right direction?
There are two ways I know of to do this:
cursespackage, if your programming language of choice has bindings for it.And a Google revealed ANSI Escape Codes, which appear to be a good way. For reference, here is a function in C++ to do this: