Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!rpi!leah!bingvaxu!vu0310 From: vu0310@bingvaxu.cc.binghamton.edu (R. Kym Horsell) Newsgroups: comp.lang.c Subject: Re: Catching ^C and ^Z Message-ID: <3939@bingvaxu.cc.binghamton.edu> Date: 5 Sep 90 12:37:12 GMT References: Reply-To: vu0310@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell) Organization: SUNY Binghamton, NY Lines: 35 In article deen@utopia.rutgers.edu (Cinnamon Raisin) writes: \\\ >#include >#include >#include >char TMP; /* to hold keyboard entry */ >struct sgttyb *TTY; /* From unix ref */ > >int main(void) >{ > ioctl(0,TIOCGETP,TTY); /* Get current status */ > TTY->sg_flags = RAW | ECHO; /* Unprocessed and echoed */ > ioctl(0,TIOCSETN,TTY); /* to the screen */ > while(1 == 1) {TMP = getchar();} > exit(0); A small problem here -- where's the storage for the ioctl buffer? You have only defined the _pointer_ to that storage area. What you need is ... struct sgttyb buffer; ... ioctl(...,&buffer); ... And then _maybe_... There are a few conflicting standards for controlling terminals these days (oh, for the good old (simple) days of sgtty)! You may want to look up the ``termio'' stuff in your documentation. -Kym Horsell ====== P.S. Be careful not to lock up your terminal >:-)