Rewriting characters in the command window

I want to output some characters in a C # console application and then rewrite them, thereby changing the characters in the position already taken in the command window. So, for example, I could show progress in percentages of 10%, 20%, 30% (but in the same place). How can i do this?

+3
source share
2 answers

If you type the character '\ r', the cursor will return to the current line, for example.

Console.Write("10%\r");
// then..
Console.Write("20%\r");
+2
source

Source: https://habr.com/ru/post/1735214/


All Articles