signal 에관해 질문드립니다.
글쓴이: ShinDy / 작성시간: 월, 2003/04/28 - 4:34오후
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
int my_signal();
int count = 0;
int main()
{
int i=0;
if(signal(SIGINT,my_signal) == SIG_ERR) {
printf("Error\n");
exit(0);
}
while(count < 3)
{
sleep(1);
printf("%d\n",i++);
}
return 0;
}
int my_signal() {
printf("\nCTRL-C pressed.\n");
count++;
signal(SIGINT,my_signal);
return 0;
}
이소스 그대로 리눅스에서 컴파일하니 에러가 나네요..
signal 함수의 두번째 인자의 my_signal 이 포인터타입이 과 맞지않다고 나오는데 명시적으로 &로전달해도 에러가나는데...어떻게 해야되나요.??
Forums:
시그날 handler 가 prototype 과 맞지 않네요..[c
시그날 handler 가 prototype 과 맞지 않네요..
from saibi
댓글 달기