delorie.com/archives/browse.cgi | search |
From: | "DeHackEd" <notgiven AT out DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
References: | <67aX2.3258$%W6 DOT 12639 AT wagner DOT videotron DOT net> |
Subject: | Re: HELP, i'm a newbie |
Lines: | 46 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2014.211 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211 |
Message-ID: | <U9gX2.5537$ho1.1189@tundra.ops.attcanada.net> |
Date: | Mon, 03 May 1999 11:56:36 GMT |
NNTP-Posting-Host: | 142.194.222.184 |
X-Trace: | tundra.ops.attcanada.net 925732596 142.194.222.184 (Mon, 03 May 1999 11:56:36 GMT) |
NNTP-Posting-Date: | Mon, 03 May 1999 11:56:36 GMT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
OmniMeta <meta AT psxrocks DOT com> wrote in message news:67aX2.3258$%W6 DOT 12639 AT wagner DOT videotron DOT net... > This program won't print Hello until it end. > if I do a step by step debug, I see that he won't show "Hello" on the screen > until it had ended. > And if I run the hello.exe program, I don't see Hello during the getch(). This is the way DJGPP's printf works. It doesn't actually write the string to the screen until you either force it using fflush or send a "\n" symbol. > How can I get printf to work correctely, to print to the screen immediately, > before the program end ? I'll modify the code... > #include <stdio.h> > #include <conio.h> > > int main() > { > char a[]="Hello"; > int key_p; > > clrscr(); > > printf("%s",a); // This is all there is to it fflush(stdout); > key_p=getch(); > printf("\n%c",key_p); > return 0; > } -- "DeHackEd" My Email address in the header is fake (spammers). Email me at this address: http://www.geocities.com/cgi-bin/homestead/mail.pl?dehacked
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |