On Thu, 28 Nov 2002, Eric Auer wrote: > anybody knows how I would write a Control Break handler for EDIT 0.5b ?
Borland/Turbo C has a wrapper for it: ctrlbrk() (in conjunction with setcbrk and getcbrk) Syntax #include <dos.h> void ctrlbrk(int (*handler)(void)); Description Sets control-break handler. ctrlbrk sets a new control-break handler function pointed to by handler. The interrupt vector 0x23 is modified to call the named function. ctrlbrk establishes a DOS interrupt handler that calls the named function; the named function is not called directly. The handler function can perform any number of operations and system calls. The handler does not have to return; it can use longjmp to return to an arbitrary point in the program. The handler function returns 0 to abort the current program; any other value causes the program to resume execution. Return Value ctrlbrk returns nothing. Example: #include <stdio.h> #include <dos.h> #define ABORT 0 int c_break(void) { printf("Control-Break pressed. Program aborting ...\n"); return (ABORT); } void main(void) { ctrlbrk(c_break); for(;;) { printf("Looping... Press <Ctrl-Break> to quit:\n"); } } If you need something different, you can hook up INT-23 and do whatever you want -- you have to use an "interrupt" function then and manipulate the registers accordingly; FreeCOM includes an assembly portion therefore. Bye, -- Steffen Kaiser The current maintainer of [EMAIL PROTECTED] http://freedos.sourceforge.net/freecom/FreeCOM.html ---------- list options/archives/etc.: http://www.topica.com/lists/fd-dev unsubscribe: send blank email to: [EMAIL PROTECTED] ==^================================================================ This email was sent to: archive@mail-archive.com EASY UNSUBSCRIBE click here: http://topica.com/u/?bz8Rv5.bbRv4l.YXJjaGl2 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================