Mail Archives: djgpp/1997/01/13/09:03:40
Alaric Dailey (alaric AT oasis DOT novia DOT net) wrote:
OK here is what I have changed my code to -
#include <signal.h>
#include <stdio.h>
void ctrlbrk(fptr)
int (*fptr)();
{
signal(SIGINT,fptr);
}
int terminate()
{
puts("ending function called!");
exit(0);
}
main()
{
ctrlbrk(terminate);
while(1)
puts("I am running on and on!");
}
this compiles with the following warning
ctrlbrk.c:8: warning: passing arg2 of `signal; from incompatable pointer
type
since it is only a warning when it finishes then runs as I expected it to,
so now my questions change. Although I am familiar with pointers, I am
not great with them, so how do I fix the warning. Second when you change
the extention and compile it as c++ you get the errors that follows -
ctrlbrk.cc:5: `ftpr' was not declared in this scope
ctrlbrk.cc:6: parse error before `int'
ctrlbrk.cc:7: parse error before `{'
ctrlbrk.cc: In function `int main()':
ctrlbrk.cc:18: warning implicit declaration of function `int ctrlbrk(...)'
why is this?
--
####################################################
We go left, right, left, right, left-
They're left in the right again.
We go right, left, right, left, right-
We've no rights left anymore.
-Martin Walkyier (Skyclad)
- Raw text -