www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/07/15:32:50

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Mon, 07 Jan 2002 22:29:17 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "osmosis" <charlieo AT ukonline DOT co DOT uk>
Message-Id: <2110-Mon07Jan2002222916+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.1.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <SIm_7.17759$Si6.4186062@monolith.news.easynet.net>
(charlieo AT ukonline DOT co DOT uk)
Subject: Re: scanf
References: <SIm_7.17759$Si6 DOT 4186062 AT monolith DOT news DOT easynet DOT net>
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

> From: "osmosis" <charlieo AT ukonline DOT co DOT uk>
> Newsgroups: comp.os.msdos.djgpp
> Date: Mon, 7 Jan 2002 19:32:49 -0000
> 
> why does
> 
> int d;
> scanf("%d ", &d);
> printf("%d ", d);
> 
>  not print integer immediately, instead requiring to press a non-numerical
> character first?

Because stdout is buffered.  Either use fflush or end the format
string with a \n, and the output will appear immediately.

See section 9.5 of the DJGPP FAQ list for more details about this.

- Raw text -


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