3

Is it possible to display progress on one line instead of having the for-loop printing out a bunch of lines for every action?

Like, for example. Instead of this:

Progress: 0%
Progress: 15%
Progress: 50%
Progress: 100%

It does all that in one line (while showing progress, of course):

Progress: 100%

Basically, I'm making a sockets program to transfer files from one socket to another socket. And it's taking the amount transferred divided by the file size multiplied by 100 to get its percentage.

Jack S
  • 43
  • 2
  • 4
    http://stackoverflow.com/a/888569/1870760 – Hatted Rooster Oct 14 '16 at 08:36
  • 2
    Possible duplicate of [How can I update the current line in a C# Windows Console App?](http://stackoverflow.com/questions/888533/how-can-i-update-the-current-line-in-a-c-sharp-windows-console-app) – Am_I_Helpful Oct 14 '16 at 08:41

1 Answers1

3

Use

printf ("\r progress =%d", progress)
Rishikesh Raje
  • 8,556
  • 2
  • 16
  • 31