[net.micro.amiga] Trapping ^C in C programs

wrz@riccb.UUCP (William R. Zielinski ) (10/31/85)

(In response to the question about trapping control-C from C programs.)

I also had trouble finding information about this in the manuals; however,
in the file :examples/README on my Lattice V3.02 disk, I found the following:

...
- TASK INTERRUPTION -
Detection of the Ctrl-C and Ctrl-D is provided in the I/O library.  If the 
external integer location Enable_Abort is set to non-zero a check for these
conditions is performed every time a level-1 I/O call is made.  If either of
these keys were pressed, the appropriate character is echoed to stdout, all
files are closed, and the program terminates.  Programs that do not use 
level-1 I/O or that wish to check more frequently may call the function
Chk_Abort(), which will return zero if neither of the keys were pressed,
or the signal value if either key was pressed.  Note that if Enable_Abort is
non-zero a successful call to Chk_Abort (either key had been pressed) will
result in program termination as described above.
...


I hope this helps!  (haven't tried it myself)



					> Bill <