Mail Archives: djgpp/1997/01/12/17:38:28
From: | alaric AT oasis DOT novia DOT net (Alaric Dailey)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: catching a CTRL C / Just for Eli and DJ Delorie
|
Date: | 12 Jan 1997 16:05:16 GMT
|
Organization: | Novia Internetworking <> 28.8kbps dialup; 402/390-2NET
|
Lines: | 31
|
Message-ID: | <5bb23s$6oq@nntp.novia.net>
|
References: | <5b9r78$h1f AT nntp DOT novia DOT net>
|
NNTP-Posting-Host: | oasis.novia.net
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Ok Eli here is the post you asked for explaining how to call this ctrlbrk
function (including the change to "signal")
#include <stdio.h>
void ctrlbrk(fptr)
int (*fptr)();
{
int signal (int, int (*fptr)());
signal (SIGINT, fptr);
}
void teminate(void)
{
puts("I am doing clean up and exiting because you hit Contro-C");
exit(0);
}
int main()
{
ctrlbrk(terminate); // when ^c is hit call the cleanup funtion
while (1)
puts("I am running on and on and on and on!");
}
The explaination is simple the program should do the while loop until you
hit ^C in which case it will call the function "terminate", any help
would be appreciated since I have not yet tried the change to "signal" yet
I will go see if that helps at all.
TTFN
- Raw text -