Rewriting characters in command window

后端 未结 2 2021
抹茶落季
抹茶落季 2021-01-19 06:39

I want to output some characters in C# console application and then rewrite them, thus changing characters in position already occupied in command window. So for for example

相关标签:
2条回答
  • 2021-01-19 06:57

    If you print a '\r' character, the cursor will return back to the current line, e.g.

    Console.Write("10%\r");
    // then..
    Console.Write("20%\r");
    
    0 讨论(0)
  • 2021-01-19 07:12

    Have a look at Writing string at the same position using Console.Write in C# 2.0

    • Console.SetCursorPosition Method
    • Console.CursorLeft Property
    • Console.CursorTop Property
    0 讨论(0)
提交回复
热议问题