delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/05/22:20:59

Date: Sun, 5 May 1996 18:39:55 +0800 (GMT+0800)
From: Orlando Andico <orly AT abigail DOT eee DOT upd DOT edu DOT ph>
To: "Rafael R. Sevilla" <rsevilla AT upd DOT edu DOT ph>
cc: DJGPP Mail Server <djgpp AT delorie DOT com>
Subject: Re: Screen updates with \b
In-Reply-To: <Pine.SOL.3.91.960505205409.13837B-100000@sauron>
Message-ID: <Pine.LNX.3.91.960505183608.5127A-100000@abigail.eee.upd.edu.ph>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019