REM!Exefile C:\bbcsigint.exe,encrypt,console INSTALL @lib$+"CALLBACK" CTRL_C_EVENT = 0 SYS "GetStdHandle", -10 TO @hfile%(1) SYS "GetStdHandle", -11 TO @hfile%(2) *INPUT 13 *OUTPUT 14 ON ERROR PRINT REPORT$ : QUIT ERR CtrlC% = FALSE handler% = FN_callback(FNsigint(), 1) SYS FN_syscalls("SetConsoleCtrlHandler"), handler%, 1 TO !FN_systo(res%) IF res%=0 PRINT "Could not set SIGINT handler" : QUIT 1 PRINT "Press Ctrl+C to test...." TIME = 0 Time% = 50 REPEAT WAIT 1 IF TIME > Time% THEN PRINT Time% Time% += 50 ENDIF UNTIL CtrlC% PRINT "Ctrl+C was pressed after "; TIME/100 " seconds." QUIT DEF FNsigint(T%) CASE T% OF WHEN CTRL_C_EVENT: CtrlC% = TRUE : = 1 ENDCASE = 0