delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
Date: | Mon, 7 Jan 2002 15:10:14 -0500 |
Message-Id: | <200201072010.g07KAEA00886@envy.delorie.com> |
From: | DJ Delorie <dj AT delorie DOT com> |
To: | 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 |
> scanf("%d ", &d); > printf("%d ", d); > > not print integer immediately, instead requiring to press a non-numerical > character first? Because the console (stdin/stdout) is line-oriented. You have to enter a whole line, and then your program processes it. You have to print a whole line before it's printed. Try using fflush(stdout) for the second problem; for the first you should use fgets() or one of the console-specific functions like getkey(). Besides, if you don't press a non-numerical character, how does your program know that you're done typing in the number?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |