-
Re-writing the same line
I've written a small file server/client for *nix and I'm just clearing the rough edges:
The program reports the percentage of the file that has been transfered but it writes a new line every time it refreshes the value like this:
"11%
22%
34%
..."
My doubt is how do I make it simply "update" the value without creating an new line (I know curses would probably do it,even though I've never used it) but this is a very tiny program and it would get "bloated" if I had to include the whole curses library, plus I only want to use that particular feature.
Any suggestions?
Thanks!
-
printing backspaces ( char 9 ) might help.
Kurt
-
printf("%02d%%\b\b\b", percentage);
fflush( stdout );
-
Doh!:eek: Didn't know you could "print" backspaces...
Silly me, thanks for the help!