Unfortunately I encountered problems after finding my function.
What I want to do is to handle the situation where the user tries to end the program by "Ctrl-C" so a temp-file is erased before exiting the program.
I found the function signal(), but I'm not sure how to use it. It seems that you can set it to do some default action when you receive a Ctrl-C for example, but how do I handle it? Can I get it to call a different function for example?
That is if I set a global boolean to true when I have created the tempfile, but before I am done with what I want to do I can erase the tempfile before exiting? (And how would I do that?)