Path: utzoo!mnetor!uunet!lll-winken!lll-tis!oodis01!uplherc!sp7040!obie!wsccs!terry From: terry@wsccs.UUCP (Every system needs one) Newsgroups: comp.lang.c Subject: Re: gotos Message-ID: <510@wsccs.UUCP> Date: 30 Apr 88 04:37:31 GMT References: <1988Apr8.183815.3187@utzoo.uucp> <449@goofy.megatest.UUCP> <3490@bunker.UUCP> Lines: 33 In article <3490@bunker.UUCP>, garys@bunker.UUCP (Gary M. Samuelson) writes: [...] > What you really want is to get an interrupt if a key is pressed. > If you can do that, then the code becomes much simpler. If you > can't get either a "key pressed" interrupt or an interval timer > interrupt, then use a state machine. (Credit has to go to Dave > Burton; although I frequently use state machines, I hadn't thought of it > in the previous case.) how's about: extern volatile key_interrupt; for( ;;) { switch( whatever) { case 1: ... case 2: ... default: ... } if( key_interrupt) break; } | Terry Lambert UUCP: ...{ decvax, ihnp4 } ...utah-cs!century!terry | | @ Century Software OR: ...utah-cs!uplherc!sp7040!obie!wsccs!terry | | SLC, Utah | | These opinions are not my companies, but if you find them | | useful, send a $20.00 donation to Brisbane Australia... | | 'Admit it! You're just harrasing me because of the quote in my signature!' |