www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/19/12:08:06

Message-ID: <32E251B8.1C3E@dmv.com>
Date: Sun, 19 Jan 1997 11:54:16 -0500
From: Pyro Technic <invid AT dmv DOT com>
Reply-To: invid AT dmv DOT com
Organization: Happy 'N Snappy PC Repair
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: getch() and getche()

i don't no if NE1 else has noticed this but there is a very annoying
featire with getch() and getche(). as a newbie i'd much appreciate NE1
who could point out how to fix it.

Here's the problem.

--code segment--
 cout << "Y for yes or N for No: ";
 answer = getche();
 ......
--end--

the output is weird. your given a blank screen. if U procede as if the
message had appeared( push 'Y' for instance) then 'Y' is diplayed
followed by "Y for yes or N for No: ". weird
 
although if it is written like this
--code segment--
cout << "Y for yes or N for No:\n";           //note the \n addition
answer = getche();
......
--end--

then the message gets displayed, but Y is on the next line.

	tanx,
	Pyro

- Raw text -


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