Mail Archives: djgpp/1998/05/13/03:47:21
>Yes, I know that it is not optimised fully, but the routine is there and I
>know it works. Why does it not prompt you for your password until after
you
>have typed it?
[...]
>for (count=0;count<5;count++)
> {
> while (kbhit()!=0);
> letter[count]=getch();
> printf("*");
> }
In DJGPP "printf" is line buffered. It doesn't output anything until the
buffer
is full or a '\n' is output.
You can override this using the "fflush(stdout)" function. It forces the
buffer
to be put on screen even if none of the two conditions stands.
>It works if I use cprintf or scanf, so I assume that after printf is used,
>the text is not printed until some interrupt is set off (like a function
>call). I thought it was the simple "print to stdout" routine?
It is! cprintf is designed for console output, so it must write every
character
immediately on the screen.
printf is designed for generic stdout output, so it is buffered for
performance reasons.
This is a classical problem most of DJGPP beginners meet (I did too :-)
and IIRC Eli is going to put it on next FAQ release.
ciao
Giacomo
- Raw text -