www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/12/14:11:10

From: alaric AT oasis DOT novia DOT net (Alaric Dailey)
Newsgroups: comp.os.msdos.djgpp
Subject: catching a CTRL C
Date: 12 Jan 1997 05:01:28 GMT
Organization: Novia Internetworking <> 28.8kbps dialup; 402/390-2NET
Lines: 26
Message-ID: <5b9r78$h1f@nntp.novia.net>
NNTP-Posting-Host: oasis.novia.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ok I am working with a piece of code that will catch a ^C or ^Break
here it is

void ctrlbrk(fptr)
	int (*fptr)();
{
	int _signal_ (int, int (*fptr)());
	_signal_ (SIGINT, fptr);
}

now the way this should work is you call this at the beginning of your
program like so-

ctrlbrk(terminate);

where "terminate" is the function you want to run when the ^C is hit, and
then go merrily about your program, being assured that if someone kills
your program it will clean up after itself.  The problem is that is I
compile it a C code I get the follwing errors -

In finction `ctrlbrk':
`SIGINT' undeclared (first use in this function)

and if I try to use it in c++ code I get all sorts of errors
am I over looking something or Missing the SIGINT declaration, what is
wrong it works on one of my other compilers?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019