www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/05/05:17:15

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: printf() and shl Questions
Date: Wed, 02 Jul 1997 20:25:14 -0700
Organization: Alcyone Systems
Lines: 26
Message-ID: <33BB1B9A.47DBC6CE@alcyone.com>
References: <19970630090816 DOT 13952 DOT rocketmail AT send2 DOT rocketmail DOT com>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jeffery Guan wrote:

> You could always use setvbuf to flush out the stdout.
> eg....
> 
> void main(void)
>  {
>         setvbuf(stdout, NULL, _IONBF, 0);
>         printf("Hello world");
>         getch();
>  }

Without having to change the buffering mode for printf, you can just use
fflush when you need to:

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

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
     "Covenants without the sword / are but words."
                                 / Camden

- Raw text -


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