www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/09/03:37:30

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: djgpp AT delorie DOT com
Date: Wed, 9 Oct 1996 08:26:36 GMT
Subject: Re: Trouble with getche()
Message-ID: <7845A435CD@fs2.mt.umist.ac.uk>

  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 -


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