![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2004
Posts: 5
Rep Power: 0
![]() |
Hi,
I'm trying to disable/ignore the ctrl+c in a c++ program. I did it alot on UNIX but somehow it doens't work on WindowsXP, I'm using the right function and typedefs but still....nothing. I'm doing something like: void someFunction(int sigNum){ signal (SIGINT,somefunction); cout<<"eh eh, you can't use ctrl+c"<<endl; } main(){ signal(SIGINT,somefunction); /* Shell program */ } I debuged the code and it looks like it's doesn't get into the someFunction at all and terminates and program as if I didn't use the signal function. Any ideas? thanks a lot. |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Nov 2004
Posts: 250
Rep Power: 4
![]() |
I don't have any problems using this test program:
#include <iostream>
#include <csignal>
using namespace std;
void sig_handler ( int )
{
signal ( SIGINT, sig_handler );
cout<<"Interactive attention disabled"<<endl;
}
int main()
{
signal ( SIGINT, sig_handler );
while ( 1 )
;
} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|