X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: "Rafal 'Raf256' Maj" Newsgroups: comp.os.msdos.djgpp Subject: Re: ANSI to read the keyboard before ENTER is pressed Date: 29 Apr 2002 00:12:57 GMT Organization: news.onet.pl Lines: 30 Sender: raf256 AT poczta DOT onet DOT pl@62.233.182.179 Message-ID: References: <20020428235953 DOT 73775 DOT qmail AT web11306 DOT mail DOT yahoo DOT com> NNTP-Posting-Host: 62.233.182.179 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-Trace: news.onet.pl 1020039177 27737 62.233.182.179 (29 Apr 2002 00:12:57 GMT) X-Complaints-To: abuse AT onet DOT pl NNTP-Posting-Date: 29 Apr 2002 00:12:57 GMT User-Agent: Xnews/5.03.24 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com PEDRO IZECKSOHN wrote in news:20020428235953 DOT 73775 DOT qmail AT web11306 DOT mail DOT yahoo DOT com: > > Hello, Is in ANSI some C function to read the keyboard > for some key pressed, (even the special keys), before the > ENTER is pressed ? normaly no, but ther is some way to change terminal behawiour... I didn't test it, but maybe it will work : #include #include #include int main () { struct termios przed, po; int c; tcgetattr (0, &przed); po = przed; po.c_lflag &= ~(ICANON | ECHO); tcsetattr (0,TCSANOW, &po); do { c = getchar(); printf ("Key: %c\n", c); } while (c != 'q'); tcsetattr (0, TCSANOW, &przed); return 0; }