On 06 Feb 2008, at 11:27, Michael Van Canneyt wrote:
You can catch this signal using a signal handler: PROGRAM ExControlC; (* How to capture [Ctrl+C] in Object Pascal. *) {$mode objfpc}{$H+} USES SysUtils,baseunix; procedure term(sig :longint);cdecl; begin Writeln('Interrupt caught'); Halt; end;
Note that in real programs, you should never call writeln (or pretty much any other RTL function) from a signal handler, as many routines are not re-intrant (and there is no documentation regarding which routines are safe to call from signal handlers and which aren't).
Jonas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal