delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/14/08:16:13

From: J P Morris <b52g AT usa DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: wierd problem
Date: Fri, 14 Nov 1997 09:11:10 +0000
Organization: IT-HE
Message-ID: <346C15AE.21C6CB2@usa.net>
References: <01bceff6$b2df4060$63206ccb AT ashod> <346B528D DOT 610B AT nic DOT smsu DOT edu>
NNTP-Posting-Host: no-dns-yet.demon.co.uk
MIME-Version: 1.0
Lines: 30
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tony O'Bryan wrote:
> 
> 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");

Interesting.
Presumably this only happens with UNIX C compilers.
This never happened with Borland, and it had me confused for a while.

-- 
* JP Morris        aka DOUG the Eagle (Dragon)  -=UDIC=-     *
* b52g AT usa DOT net         Author of the U6 develorer's kit      *
**************************************************************
* http://members.tripod.com/~JPMorris - Ultima, Doom, AViOS  *

- Raw text -


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