#include <stdio.h>
#include <signal.h>
#include <unistd.h>

main()
{
    int count=0;

    /* SIGINT 시그널 받으면 무시하도록 설정 */
    signal(SIGINT, SIG_IGN);
    while (1) {
       printf("Hello World\n");
       sleep(1);
       if (++count == 5)   /* count가 5가 되면 */
          /* SIGINT 시그널 받으면 시스템에서 기본적으로 설정한 동작을 하도록 설정 */
          signal(SIGINT, SIG_DFL);
    }
}
5초가 지날때까지 콘트롤 제트가 먹지 않는다

      c 언어  |  2007. 9. 17. 09:51



sokoban's Blog is powered by Daum & Tattertools