[comp.sys.amiga.programmer] Checking for CTRL-C

ecarroll@maths.tcd.ie (Eddy Carroll) (05/19/91)

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 <libraries/dos.h>

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