www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/09/11:23:36

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trouble with getche()
Date: Tue, 08 Oct 1996 22:26:07 -0700
Organization: Alcyone Systems
Lines: 21
Message-ID: <325B376F.776C9CB4@alcyone.com>
References: <325B1E56 DOT 5BDA AT erols 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

Tony Sideris wrote:

> This is my first day with djgpp so any help would be greatly
> appreciated.

You've just discovered the fact that the standard streams can be buffered!
The contents of the stream are only printed when the buffer fills up or a
newline is sent.

To make it print before that, you need to explicitly flush the stream.
Insert the statement

    fflush(stdout);

between the call to printf and your call to getche and you'll be all set.

-- 
                             Erik Max Francis | max AT alcyone DOT com
                              Alcyone Systems | http://www.alcyone.com/max/
                         San Jose, California | 37 20 07 N 121 53 38 W
                                 &tSftDotIotE | R^4: the 4th R is respect

- Raw text -


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