Mail Archives: djgpp-workers/1998/08/06/20:38:18
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 -