I was able to do something like this before, but I can't remember exactly how.
I believe I either printed a carriage return without a linefeed before the text each time I printed it:
Code:
while ( ... )
{
...
printf("\rCount: %3d", countVar++);
}
or I printed backspaces:
Code:
printf("Count: ");
while ( ... )
{
...
printf("%3d\b\b\b", countVar++);
}
Whatever it was, I'm sure it's not portable at all. If you have a non-standard console library available (conio.h for Windows as an example), you can use caret positioning to achieve the same thing.