P
pradeep
Hello again friends:
I'm now trying to get a signal handler to work. I have made the example
code below to check I can make it work, but there is a compiler error,
argument of type ‘void (MyApp:(int)’ does not match ‘void (*)(int)’
Can anyone help?
Thanks.
#include <iostream>
#include <signal.h>
class MyApp {
public:
MyApp(void) { signal(SIGINT, Handler); }
~MyApp(void) { signal(SIGINT, SIG_DFL); }
void Handler(int) { std::cerr << "test\n"; }
};
void main()
{
MyApp x;
sleep(10);
return 0;
}
I'm now trying to get a signal handler to work. I have made the example
code below to check I can make it work, but there is a compiler error,
argument of type ‘void (MyApp:(int)’ does not match ‘void (*)(int)’
Can anyone help?
Thanks.
#include <iostream>
#include <signal.h>
class MyApp {
public:
MyApp(void) { signal(SIGINT, Handler); }
~MyApp(void) { signal(SIGINT, SIG_DFL); }
void Handler(int) { std::cerr << "test\n"; }
};
void main()
{
MyApp x;
sleep(10);
return 0;
}