title: serial port (winAPI) : couldnt receive any data
body: <p>I'm working with sending a char 'a' from pc to MCU and return it back to PC through serial communication. Precisely, it should display 'a' but there is nothing display.
  I have tested on hyperterminal and it works fine. </p>
  
  <p>If there is any problem with my code please point it out. Thank you.</p>
  
  <p>It works fine on sending a char I guess so I post only a part of my code.</p>
  
  <pre><code>DWORD dwCommModemStatus;
  DWORD dwBytesTransferred;
  DWORD bytesWritten;
  char receivedData[2] = {0};
  
  char data= 'a';
  bool sendChar = WriteFile(hSerial,&amp;data,1,&amp;bytesWritten,NULL);
  if(!sendChar){
      printf("WriteFile ERROR\n");
  }
  
  SetCommMask(hSerial,EV_RXCHAR);
  WaitCommEvent(hSerial, &amp;dwCommModemStatus,0);
  
  if(dwCommModemStatus &amp; EV_RXCHAR){
      if(!ReadFile(hSerial,receivedData,1,&amp;dwBytesTransferred,0)){
          printf("ReadFile Error\n");
      }else{
          printf("%c\n",receivedData[0]);
      }
  }
  </code></pre>