H
hlinzhou
I am interested in digging the include directory of my favorite gcc
compiler specialized for windows(yes u get it, I use Dev-C++, but I
love c and type commands in the console).But when I find signal.h and
try it, I meet some problems.My code is:
/*signal-win.c*/
#include <stdio.h>
#include <signal.h>
#include <windows.h>
#define SIGCUST 80
void ctrlc()
{
printf("no u can not kill me\n");
signal(SIGINT, ctrlc);
}
void chandler()
{
printf("SIGCUST caught!\n");
signal(SIGCUST, chandler);
}
int main()
{
int i;
signal(SIGINT, ctrlc);
signal(SIGCUST, chandler);
while(1)
{
printf("executing...\n");
raise(SIGCUST);
Sleep(1000);
}
return 0;
}
I included windows.h bcz I want to use Sleep() function.
When I run the binary code after 'gcc -o sig.exe signal-win.c', it
outputs only 'executing..' and 'no u can not kill me' when I type
ctrl-c, where is 'SIGCUST caught!'?Does it really like somebody
described 'windows fails to be a modern O.S. after it fails in
implementing the signal mechanism' or it is just my fault?
my gcc version is 3.4.2 (mingw-special)
Thanks
compiler specialized for windows(yes u get it, I use Dev-C++, but I
love c and type commands in the console).But when I find signal.h and
try it, I meet some problems.My code is:
/*signal-win.c*/
#include <stdio.h>
#include <signal.h>
#include <windows.h>
#define SIGCUST 80
void ctrlc()
{
printf("no u can not kill me\n");
signal(SIGINT, ctrlc);
}
void chandler()
{
printf("SIGCUST caught!\n");
signal(SIGCUST, chandler);
}
int main()
{
int i;
signal(SIGINT, ctrlc);
signal(SIGCUST, chandler);
while(1)
{
printf("executing...\n");
raise(SIGCUST);
Sleep(1000);
}
return 0;
}
I included windows.h bcz I want to use Sleep() function.
When I run the binary code after 'gcc -o sig.exe signal-win.c', it
outputs only 'executing..' and 'no u can not kill me' when I type
ctrl-c, where is 'SIGCUST caught!'?Does it really like somebody
described 'windows fails to be a modern O.S. after it fails in
implementing the signal mechanism' or it is just my fault?
my gcc version is 3.4.2 (mingw-special)
Thanks