#include #include void termination_handler (int signum) { struct temp_file *p; FILE* f=fopen("log.txt","a"); fprintf(f,"Note: Values of signal: SIGINT:%d\t SIGTSTP:%d\t SIGTERM:%d\n", SIGINT, SIGTSTP,SIGTERM); fprintf(f,"Received signal:%d\n", signum); fclose(f); } int main (void) { printf("Begin of program\n"); signal(SIGINT, termination_handler); // Ctrl+C for generating the signal signal(SIGTSTP, termination_handler); // Ctrl+Z for generating the signal while (1) {} }