Mail Archives: djgpp/1998/05/26/15:00:30
Ho-Jin Dan schrieb:
>
> hmm... another getch question is on air... ^^;
> getch is not a ansi member. in other word, <conio.h> is not included in the
> gnu library.
> i think getch() is useful in many ways.
> ok... you can make a getch function such that
>
> #include <termio.h>
> #include <sys/ioctl.h>
>
> int getch() {
> struct termio o, n;
> char c;
>
> ioctl(0, TCGETA, &o);
> ioctl(0, TCGETA, &n);
>
> n.c_lflag &= ~(ICANON | ECHO);
> n.c_cc[VMIN] = 1;
> n.c_cc[VTIME]= 0;
>
> ioctl(0, TCSETA, &n);
> while(read(0, &c, 1) <= 0);
> ioctl(0, TCSETA, &o);
>
> return (int)c;
> }
Sorry, I didnīt really understand your point.:-)
The error happens without the getch(); , as well.
main(void)
{
};
Huh!Even *THAT* produces a "general protection fault"!
cu
- Raw text -