title: How can I create a file when my c program exits?
body: <p>I am working on an assignment where I am implementing the unix history command in a shell.  In my program I have written a signal handler for SIGINT.  When a user enters (ctrl)(c) their history is displayed.</p>
  
  <p>When my program terminates I need to store the history in a file.  Is there an easy way to detect when my program has exited?  Or do I need to have a signal handler for every type of signal ((ctrl)(d), pausebreak, etc).</p>