www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/27/00:46:35

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Display question...
Date: Wed, 26 Aug 1998 21:30:06 -0700
Organization: Alcyone Systems
Lines: 29
Message-ID: <35E4E0CE.7E8707D8@alcyone.com>
References: <3 DOT 0 DOT 5 DOT 16 DOT 19980827002417 DOT 0cbf3f84 AT mail DOT tir DOT com>
NNTP-Posting-Host: kamali.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Thomas J. Hruska wrote:

>   printf("Hello World!");
> 
> It won't print anything to the screen until either the program is
> finished
> or until a newline character is printed.

It's because stdout if line-buffered in DJGPP.  You should instead
either do:

    printf("Hello world!\n");

or

    printf("Hello world!");
    fflush(stdout);

The latter does the same thing that you're doing, but forces an explicit
flush of the stdout stream, regardless of buffering.

-- 
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
  San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
          USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
             \
            / Love is the true price of love.
           / George Herbert

- Raw text -


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