title: Passing HANDLE as an argument when opening a com port in C/C++ in Windows
body: <p>So I have something like as follows:</p>
  
  <p>In my main.c</p>
  
  <pre><code>HANDLE *hCom;
  success = openport(hCom);
  ReadFile(hCom......)   // This Produces Garbled Results
  </code></pre>
  
  <p>The openport() function:</p>
  
  <pre><code> int openport(HANDLE *hCom)
   {
       hCom = CreateFile(......)
       ReadFile(hCom......)   // This Produces Good Results
       return 0;
   }
  </code></pre>
  
  <p>When I do read commands inside of my openport() function everything works fine, but if I use hCom in my main.c I get garbage.</p>
  
  <p>My question is, what am I doing wrong/missing?</p>
  
  <p>Any help would be much appreciated!</p>