title: Delete .txt file when program closes/exits (X Button)
body: <p>I have a program that will create a simple txt file in the same directory as the compiled .exe:</p>
  
  <pre><code>ofstream output("myfile.txt", ios::binary | ios::trunc);
  </code></pre>
  
  <p>At the end of my program, I have this to remove it:</p>
  
  <pre><code>remove("myfile.txt");
  </code></pre>
  
  <p>Both of these work well, however, I want the file deleted if the user closes the cmd window unexpectedly, accidently, or they end the process.</p>