Mail Archives: djgpp/1997/11/14/08:16:13
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 -