Re: libncurses and getch ()
--- James Morrison <rocketmail_com@rocketmail.com> wrote:
> Hi,
>
> I've been trying to find out why pptop doesn't get characters with getch ()
> from
> libncurses. I think I traced to problem code down to something that
> resembles
> the following program.
>
> #include <unistd.h>
> #include <fcntl.h>
> #include <stdio.h>
> #include <termios.h>
>
> int main (int argc, char *argv[])
> {
> char q;
> struct termios info;
> int n, in = fileno (stdin);;
>
> fcntl (in, F_SETFL, fcntl (in, F_GETFL, 0) | O_NONBLOCK);
>
> tcgetattr (in, &info);
> info.c_lflag &= ~ICANON;
> info.c_iflag &= ~ICRNL;
> info.c_lflag |= ISIG;
> info.c_cc[VMIN] = 1;
> info.c_cc[VTIME] = 0;
>
> tcsetattr (in, TCSADRAIN, &info);
> while (q != 'q')
> {
> n = read (fileno (stdin), &q, 1);
> printf ("%d\n", n);
> sleep (1);
> }
> return q;
> }
>
> The problem is that this program works. Anyone have any ideas?
>
Now, that works, but changing read () to q = getch (), and linking against
ncurses causes this program to stop working.
=====
James Morrison
University of Waterloo
Computer Science - Digital Hardware
2A co-op
http://hurd.dyndns.org
Anyone referring to this as 'Open Source' shall be eaten by a GNU
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
--
To UNSUBSCRIBE, email to debian-hurd-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: