title: How do I CloseHandle a handle that was converted to a FILE*?
body: <p>I am trying to redirect the output of a child process and return a <code>FILE*</code> to the parent.</p>
  
  <p>I am essentially following the code example at <a href="http://msdn.microsoft.com/en-us/library/ms682499%28v=vs.85%29.aspx" rel="nofollow">Creating a Child Process with Redirected Input and Output</a>. The only modification is that i encapsulated the whole thing in a function and do </p>
  
  <pre><code>return _fdopen(_open_osfhandle((intptr_t)g_hChildStd_OUT_Rd, _O_RDONLY), "rb");</code></pre>
  
  <p>The problem is that I want to cleanup and <code>fclose</code> is throwing an error. Was I supposed to close handle after I did the <code>_fdopen</code>? How am I supposed to clean up here?</p>