Mail Archives: djgpp/1996/10/09/03:37:30
Tony Sideris <tonys111 AT erols DOT com> wrote:-
> ... copied it right out of a C book. ...
> main() {char ch; printf("Type a character: ");
> ch = getche(); printf("\nYou typed: %c", ch);}
> [produces]
> pType a character:
> You typed: p
In djgpp, output sent to stdout (= the screen, usually) by printf() is stored
in a buffer, which is only flushed to the screen when a '\n' is sent to it or
on exit from the program. After `printf("Type a character: ");' try inserting
`fflush(stdout);'.
- Raw text -