title: Does re-use of file pointers cause a memory leak?
body: <p>It's been several years since I've dealt with C++, so bear with me...</p>
  
  <p>I have a memory leak in my program which causes a run-time error.  Could this be causing the error?</p>
  
  <p>I have a global variable <code>FILE *fp;</code></p>
  
  <p>In a callback funciton, I have:</p>
  
  <pre><code>fp = fopen(filen,"w");
  // do some writing
  fclose(fp);
  </code></pre>
  
  <p>This process is repeated several times with the same pointer (fp).  Is using the same file pointer a problem?  Will fclose() automatically free up memory for me, or do I need to delete it manually?  Are there any limitations that might cause a run-time error if I'm writing large quantities of text?</p>
  
  <p>Thanks!</p>