delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/03/08:01:55

From: Chong Kai Xiong <w_velocity AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: HELP, i'm a newbie
Date: Mon, 03 May 1999 19:36:46 +0800
Organization: Singapore Telecommunications Ltd
Lines: 28
Message-ID: <372D8A4E.8A2B1DA@yahoo.com>
References: <67aX2.3258$%W6 DOT 12639 AT wagner DOT videotron DOT net>
NNTP-Posting-Host: as002808.singnet.com.sg
Mime-Version: 1.0
X-Mailer: Mozilla 4.04 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

OmniMeta wrote:

> 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().
>
> How can I get printf to work correctely, to print to the screen immediately,
> before the program end ?
>
> #include <stdio.h>
> #include <conio.h>
>
> int main()
> {
>     char a[]="Hello";
>     int key_p;
>
>     clrscr();
>
>     printf("%s",a);
>     key_p=getch();
>     printf("\n%c",key_p);
>     return 0;
> }

Are you sure? I typed in the program listing and it worked perfectly fine...

- Raw text -


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