title: How to add and display hours, minutes, seconds of data taken from the serial port with C programming
body: <p>I took temperature data from the Arduino serial port. Temperature data coming out of the Arduino serial monitor are:</p>
  
  <pre><code>21.48
  21.97
  21.48
  21.00
  21.97
  21.97
  </code></pre>
  
  <p>By using the C program to read the serial port as below
  code:</p>
  
  <pre><code>char TempChar;
  DWORD NoBytesRead;
  do{
      ReadFile(hComm,&amp;TempChar,sizeof(TempChar),&amp;NoBytesRead,NULL);
      printf("%c",TempChar);                            }
  while(!kbhit());
  </code></pre>
  
  <p>Then it will appear like this.</p>
  
  <pre><code>21.48
  21.97
  21.48
  21.00
  21.97
  21.97
  </code></pre>
  
  <p>Now I want to add and display hours, minutes and seconds using the c program like the code below:</p>
  
  <pre><code>char TempChar;
  DWORD NoBytesRead;
  
  SYSTEMTIME str_t;
  GetSystemTime(&amp;str_t);
  
  do{
     ReadFile(hComm,&amp;TempChar,sizeof(TempChar),&amp;NoBytesRead,NULL);
      printf("%c, %d:%d:%d ",TempChar,str_t.wHour+7,str_t.wMinute,str_t.wSecond);
   }while(!kbhit());
  </code></pre>
  
  <p>but the result is like this :</p>
  
  <pre><code>, 18:9:38  1, 18:9:38 ., 18:9:38 ., 18:9:38 0, 18:9:38 0, 18:9:38
  , 18:9:38 2, 18:9:38 1, 18:9:38 ., 18:9:38 0, 18:9:38 0, 18:9:38
  , 18:9:38 2, 18:9:38 1, 18:9:38 ., 18:9:38 0, 18:9:38 0, 18:9:38
  </code></pre>
  
  <p>I actually want the result is</p>
  
  <pre><code>21.48,18:9:38
  21.97,18:9:38
  21.48,18:9:38
  21.00,18:9:38
  21.97,18:9:38
  21.97,18:9:38
  </code></pre>
  
  <p>What should I fix from the C language program code?</p>