Mail Archives: djgpp/1996/05/05/22:20:59
On Sun, 5 May 1996, Rafael R. Sevilla wrote:
<snip>
> backspace character (ASCII 8, or "\b") to standard output until I get back
> to the start of the output line and then printed the update. This works
> properly with Turbo C under DOS and GCC 2.7.2 under Solaris 5.3, but not
> under djgpp. What djgpp does is wait until the _last_ such update before
<snip>
The last update bit is caused by DJGPP's 4-Kb output buffer. I personally
prefer using something like this:
while (whatever)
{
printf ("%.4d foos processed\r", foo);
fflush (stdout);
}
You don't have to bother with a lot of backspacing when a single carriage
return will do ;-)
Just remember to do a \n when you're done so that your next message
doesn't crap over the previous stuff. Also, the fflush ensures that the
buffer gets emptied and you see what you want. I suppose the 4-Kb crap is
'cause stdio uses DOS interrupts and realmode switches are expensive in
terms of CPU cycles.
Cheers,
Orly
- Raw text -