#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
void func(int sin)
{
//printf("我是ctrl+c,被接受了\n");
system("rm -r ./flag.c");
exit(1);
}
int main(int argc , char *argv[])
{
FILE *fp;
if(NULL == (fp = fopen("./flag.c", "r"))){
if(NULL == (fp = fopen("./flag.c", "w"))){
printf("打開檔案失敗\n");
}
fclose(fp);
}else{
printf("隻能運作一個應用程式\n");
exit(1);
}
printf("ctrl+c 退出\n");
signal(SIGINT,func);
while(1);
return 0;
}