Message-ID: <33234ED6.70F0@pobox.oleane.com> Date: Mon, 10 Mar 1997 00:59:18 +0100 From: Francois Charton Organization: CCMSA MIME-Version: 1.0 To: LSC CC: djgpp AT delorie DOT com Subject: Re: please help, wrong result from this program References: <01bc2cbc$6888c980$63708ea1 AT a> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit LSC wrote: > > #include > #include > > int main() > { > char keyinput; > gotoxy(2,2); > printf("testing"); > gotoxy(5,15); > printf("testing 2"); > while (keyinput != 13) keyinput=getch(); > return 0; > } > In DJGPP, stdio functions are buffered: the strings you write with printf (for instance) are written into a buffer, which is output to the screen either when the buffer is full, or when a "\n" is seen, or when you call fflush(stdout). To make your program behave the way you want it to, you may either - use printf("testing\n"); (note the \n) - use cprintf instead of printf - call fflush(stdout) after printf() so that the contents of the printf are dumped to the screen. Francois