home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / ibm / pc / misc / 11645 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.4 KB  |  52 lines

  1. Newsgroups: comp.sys.ibm.pc.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!sunee.uwaterloo.ca!rtang
  3. From: rtang@sunee.uwaterloo.ca (The One Your Mother Warned You About!)
  4. Subject: WatcomC and signal catches
  5. Message-ID: <Bt7tEJ.Iu3@watserv1.uwaterloo.ca>
  6. Sender: news@watserv1.uwaterloo.ca
  7. Organization: University of Waterloo
  8. References: <1992Aug19.042249.10838@sarah.albany.edu>
  9. Date: Wed, 19 Aug 1992 05:18:18 GMT
  10. Lines: 40
  11.  
  12. Hope this is where this is supposed to go.
  13. Anyways,
  14. Has anyone out there used WATCOM C 386 compiler with DOS
  15. extender?  I am having some trouble with the signal()
  16. function. It doesnt seem to do what its supposed to.
  17.  
  18. In my code I have:
  19.  
  20. #include <signal.h>
  21. #include <stdio.h>
  22. main()
  23. {
  24.     for (;1==1;) {
  25.     signal(SIGINT,myhandler);
  26.     }
  27. }
  28.  
  29. void
  30. myhandler(void)
  31. {
  32.     printf("Control C pressed\n");
  33.     
  34. }
  35.  
  36. This is not the actual program I have, but has all the parts the 
  37. deal with the problem. Actually, in the handler, I have a longjmp
  38. back into the main, which runs other code.  But the problem
  39. is that thesignal catch isnt working at all, and control-C
  40. breaks out of the program still.
  41.  
  42. Is there a setting I have to do in compiling or linking to
  43. let Watcom C know about the signal catch? or some environment
  44. variable?? I've actually typed in an example in the manual
  45. and that doesnt work either. So what am I doing wrong?
  46.  
  47. Please email me direct if you have any ideas.
  48. Thanks,
  49.  
  50.  
  51. RAY
  52.