I'm writing console applications on NT. My program runs in a while loop that it never exits, but I have to do some clean up procedures when the program is killed. I put all these procedures in a clean_up function and use atexit() to achieve this, but when I use Ctrl-C to terminate the program, my clean_up function is not executed. What is the best way to ensure the clean_up function is executed? (The program may be killed in ways other than Ctrl-C also.)
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.