www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/08/06/20:38:18

Sender: nate AT cartsys DOT com
Message-ID: <35CA4428.27B48B43@cartsys.com>
Date: Thu, 06 Aug 1998 17:02:48 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
MIME-Version: 1.0
To: Carlos Eduardo Dantas de Menezes <menezes AT lsi DOT usp DOT br>
CC: dj AT delorie DOT com, djgpp-workers AT delorie DOT com, Vik DOT Heyndrickx AT rug DOT ac DOT be
Subject: Re:
References: <Pine DOT LNX DOT 3 DOT 96 DOT 980805194422 DOT 1773A-100000 AT apolo DOT lsi DOT usp DOT br>

Carlos Eduardo Dantas de Menezes wrote:
> 
> Dear colleagues,
> 
> I am having some problems with an earlier version (about 1 year
> old) of DJGPP and I would like to know if this bug was corrected
> in latest version.
> It is related with input/output stream: when I mix a function
> like getc (conio.h) with scanf, the behavior of input stream is
> uncommon - sometimes, one scanf command is ignored - and
> fflush(stdin) doesn't works!
> Similar things occur with output stream when I use gotoxy function:
> sometimes, characteres doesn't appear when printf is used!

It is not a bug.  stdio functions use line buffering when connected to
the terminal, so the text will not appear until you print a newline or
`fflush(stdout)'.  This is documented in several places, notably FAQ
section 9.4.  In general, mixing stdio and conio is to be avoided; use
one or the other.

fflush(stdin) is not supposed to work; ANSI says that the effect of
fflush'ing an input stream is undefined.  The fact that some compilers
(like Borland) do something useful in that case is their own extension
and is not portable.
-- 

Nate Eldredge
nate AT cartsys DOT com


- Raw text -


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