468,770 Members | 2,356 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,770 developers. It's quick & easy.

Difference between signal() and sigaction() function

Hello Sir...Could you tell me the KEY difference between signal and sigaction functions....Kindly consider the following sample program which is using signal function...
Expand|Select|Wrap|Line Numbers
  1. #include <signal.h>
  2. void mysighandler(void);
  3. int main ()
  4. {
  5.     signal(SIGINT,mysighandler);
  6.     char ch;
  7.     while(1) {
  8.         ch=getchar();
  9.         putchar(ch);
  10.     }
  11. }
  12. void mysighandler(void);
  13. {
  14.     printf("interrrupt signal recieved\n");
  15. }
The above main function goes into infinite loop ...when I press ctrl-C my signal handler is getting executed..upto this is fine..
But what difference it makes when I use sigaction() system call in the above program...
I would be thankful if you help me...
May 11 '07 #1
2 5336
3,237 Expert 2GB
I have moved this thread to the C++ forum, as I feel the people there will be of more help then I.
May 11 '07 #2
1,251 Expert 1GB
See sigaction() and signal() for more info.

May 11 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Elf M. Sternberg | last post: by
1 post views Thread by Jorge | last post: by
3 posts views Thread by Martin McCormick | last post: by
11 posts views Thread by Jackie | last post: by
4 posts views Thread by san | last post: by
10 posts views Thread by subramanian | last post: by
2 posts views Thread by Achint Mehta | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.