Wednesday, 15 August 2012

c - Signal handling doesn't work with -ansi or with POSIX define -


I am trying to use the signal function (I know that it dislikes and its problems with many portability I can not use Ignition).

I also need to compile with -exclusive and -D_POSIX_C_SOURCE = 200112L

, if I compile one of these flags, the signal works only once is. How can I get the same behavior with these flags without using the sign?

  #include & lt; Signal.h & gt; # Include & lt; Stdio.h & gt; Fixed zero signal_handler (int NBR) {(zero) NBR; ("\ NHi!"); } Int main {signal (sign, signal_handler); ("Hi!"); While (42); Return (0); }  

Keep in mind, the code above has an infinite loop.

thanks :)

No comments:

Post a Comment