Many programs are capable to rewrite on the same line, not in a STDOUT way.For example scp write the percentage or many installation programs will show you the nice rotating wheel.How it works?
How is possible for a program to write on the same line?
shell
Assuming that you are talking about console programs, and not progress dialogs in a GUI, the effect of overwriting the last line can be achieved with STDOUT and with just about any console.Most consoles support the carriage return character, which brings the current output position to the beginning of the current line, without otherwise altering what is shown on the console. In most programming languages, this character is represented by the escape sequence \r.When producing output with carriage return characters in it, the text after a carriage return will overwrite the last line that was written before it.If you redirect the output the ouput from a program like scp (that produces a progress indication) to a file, then in many cases the file will look similar to this (using the escape sequence for the carriage return character): 10%\r 20%\r 30%\r 40%\r 50%\r 60%\r 70%\r 80%\r 90%\r100%\r\n