Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!mcsun!ukc!tcdcs!maths.tcd.ie!ecarroll From: ecarroll@maths.tcd.ie (Eddy Carroll) Newsgroups: comp.sys.amiga.programmer Subject: Checking for CTRL-C (was Re: Dumb windows from SAS/C ... ) Message-ID: <1991May18.201928.29093@maths.tcd.ie> Date: 18 May 91 20:19:28 GMT References: <1991May14.164909.19186@NCoast.ORG> <1991May17.023000.1652@NCoast.ORG> Organization: Dept. of Maths, Trinity College, Dublin, Ireland. Lines: 29 In article <1991May17.023000.1652@NCoast.ORG> davewt@NCoast.ORG (David Wright) writes: > This is not what I want to do. I am quite familiar with the >"onbreak()" type calls, but that is not how I want to handle the >events. What *I* want to do is more like this: > > while(!gotError && !gotUserBreak()) > { > /* code here */ > } > Dave I usually use something like the following: #include int CtrlC = 0; #define CheckForBreak() \ (CtrlC |= SetSignal(0, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) I find it handy to have CtrlC around so that when I exit a loop, I can easily determine if it was due to normal termination or a user break. Eddy -- Eddy Carroll ----* Genuine MUD Wizard | "You haven't lived until ADSPnet: cbmuk!cbmuka!quartz!ecarroll | you've died in MUD!" Internet: ecarroll@maths.tcd.ie | -- Richard Bartle