X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Date: Wed, 26 Dec 2001 10:23:58 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: "Cody" Message-Id: <1659-Wed26Dec2001102358+0200-eliz@is.elta.co.il> X-Mailer: emacs 21.1.50 (via feedmail 8 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: <3c2927d7@leia.ktsnet.com> (cody1@ktsnet.com) Subject: Re: bug in djgpp 3.0.2? surely it's my fault References: <3c24f3be AT leia DOT ktsnet DOT com> <3942-Tue25Dec2001182106+0200-eliz AT is DOT elta DOT co DOT il> <3c2927d7 AT leia DOT ktsnet DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Cody" > Newsgroups: comp.os.msdos.djgpp > Date: Tue, 25 Dec 2001 19:18:35 -0600 > > > Does it stop waiting if you press [Enter] right after the first key? > Only if the first key is EOF If so, my theory is probably wrong. I must admit thyat I don't know enough about the C++ function you called to tell how should it work. Can someone who knows that please tell? > > To get a single-key input, you need to use the termios functions to > > switch the terminal into raw mode. The library reference has the > > details. > Right. An example would be getch() in conio.h, right? No, conio's getch is DOS-specific; it uses a certain system call which always works by single characters. To write more portable code, which uses standard functions, you need to call the tcsetattr function with the ICANON bit reset in the c_lflag member of its last argument (which is a structure). After that, any input function that you call will return after a single character has been read from the terminal.