Mail Archives: djgpp/1998/05/26/09:45:22
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;
}
Lennart Marien wrote:
> Hi!
> I have a problem compiling my DJGPP-C Programs under WIn95!
> I tried the following simple code:
>
> //TEST.C
>
> main(void)
> {
> printf("BLABLABLA\n");
> getch();
> };
>
> gcc test.c
>
> GCC compiles, but WINDOWS gives me an error message:
> general protection fault
>
> The same happens under RHIDE on WIn95!
> I also noticed that all my precompiled programs(all compiled under DOS)
> don?t run on WIn95.My first thought was that WIN95 and CWSDPMI would
> have problems working with each other.So I deletet *every* copy of
> all CWS-parts from my HD and restarted the Computer.
> Unfortunately the error still happens.
> What can I do?Is there a troubleshooting FAQ for the GCC program itself?
>
> Thank you in advance!
- Raw text -