delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/17/11:27:03

Date: Thu, 17 May 2001 18:28:31 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Michiel de Bondt <michielb AT sci DOT kun DOT nl>
cc: djgpp AT delorie DOT com
Subject: Re: how to flush cprintf output
In-Reply-To: <3B03E465.818D17B8@sci.kun.nl>
Message-ID: <Pine.SUN.3.91.1010517182219.14151H@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 17 May 2001, Michiel de Bondt wrote:

> Strange. What I do is removing the bar of progress asterisks by cprintf ("\b
> \b")'s
> Then, I do printf("Some message.\n  ").

That is a bad idea.  You should not mix cprintf and printf, since they 
use different methods to deliver data to the screen.  Simply print the 
message via cprintf.

> The cprintf ("\b \b")'s might be done in a procedure
> called by an alarm event.

This just adds to complexity.  I'd advise against such complex design, 
just to print and remove a message.

> > And what do you want to do with progress indicator and search path?  IN
> > particular, what do you want to do with them if stdout is redirected?
> 
> I wish them to be printed to the screen.

Then print those with fprintf to stderr.

> > > The program dvips distinguishes console output and
> > > standard output as well, i.e. it seems so at least. How can that be?
> >
> > Perhaps because it prints part of the text to stderr and the rest to
> > stdout.
> 
> But can stderr and stdout not conflict since they are both the screen?

No, the device driver takes care of that.  In addition, you could use 
fflush to force all data to go out, if you want to be sure.

- Raw text -


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