I have a console app that performs a lengthy process.
I am printing out the percent complete on a new line, for every 1% complete.
How can I make the program print out the percent complete in the same location in the console window?
Print \r
to get back to the start of the line (but don't print a newline!)
For example:
using System;
using System.Threading;
class Test
{
static void Main()
{
for (int i=0; i <= 100; i++)
{
Console.Write("\r{0}%", i);
Thread.Sleep(50);
}
}
}