Date: Wed, 3 Jul 1996 17:45:23 -0400 (EDT) From: Justin Ward To: deuce cc: djgpp AT delorie DOT com Subject: Re: Cannot redirect getche() In-Reply-To: <4re1a1$kg5@panix2.panix.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 3 Jul 1996, deuce wrote: > In a test program using getche(), the echo to the screen could not > redirect to a file as in test >test.txt. printf() works fine. getch() and getche() read from the console (keyboard and screen), not from stdin. You can always redirect stdin and stdout, but the console is always (at least in DOS) the screen and the keyboard. Well unless you mess around with that command to read from a com port instead of the keyboard (can't remember the name right now), but that is not a common situation. Anyway, there's no real way you can redirect getch() or getche(). If you want to read from stdin, use getchar(). Be warned though, stdin (and all streams) are read a line at a time. So to get one character, a whole line of input must be typed in. Justin