www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/18/01:54:01

From: gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GETCHE() Command Error using DJGPP?
Date: 18 Feb 1997 03:30:21 GMT
Organization: Oxford University
Lines: 25
Message-ID: <5eb7od$jk6@news.ox.ac.uk>
References: <3308e01a DOT 2752561 AT news DOT akula DOT com>
NNTP-Posting-Host: mc31.merton.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

[posted and emailed]

Enemy Mindz (mceeras AT akula DOT com) wrote:

:         printf("Which character is greater?");
:         printf("\nType a single character:");
:         a=getche();
:         printf("\nType another character:");
:         b=getche();

The output from printf is line-buffered; nothing is printed until you send
a '\n' character. So, when it gets to 'a=getche();', the prompt is still in 
the buffer, not on the screen. If you call the function fflush(stdout);
before each getche(), it should work as you expected.

: Can someone help?  Thank you.. If you can help please e-mail  me at
: mceeras AT akula DOT com

Okay, but I strongly suggest that you subscribe to the newsgroup / mailing
list; your questions may have been answered before (this one comes up farily
often, in fact).

-- 
George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
Merton College, Oxford.

- Raw text -


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