From: "Tony O'Bryan" Newsgroups: comp.os.msdos.djgpp Subject: Re: wierd problem Date: Thu, 13 Nov 1997 13:18:37 -0600 Organization: Southwest Missouri State University Lines: 18 Message-ID: <346B528D.610B@nic.smsu.edu> References: <01bceff6$b2df4060$63206ccb AT ashod> Reply-To: aho450s AT nic DOT smsu DOT edu NNTP-Posting-Host: clark.a05.smsu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Ashod wrote: > > I recently wrote this. > > void main (void) > { > printf("\nHello"); > getch(); > } > > // but it did it the wrong way round.... it displayed hello after I hit a > key, > any thoughts on this ?? Welcome to C. Output is buffered. Hello won't be displayed until the output buffer is flushed. The output buffer is most easily flushed by printing a newline character: printf("Hello\n");