title: Parsing file in C++ and writing it into HTML in table
body: <p>I need to convert existing log file into HTML report. I'm working on Windows platform. Below is the example of the log messages from the log file. </p>
  
  <pre><code>Example of log file
  
  MyProcess1 16-06-14 8:32:50 8667 [Info] This is an information message
  
  MyProcess2 16-06-14 8:32:57 9876 [Warn] This warning message
  </code></pre>
  
  <p><strong>Please Note the format of the log file</strong></p>
  
  <p>MyProcess1 <em>"space"</em> 16-06-14 <em>"space"</em> 8:32:50 <em>"space"</em> 8667 <em>"space"</em> [Info] <em>"space"</em> This <em>"space"</em> is <em>"space"</em> an <em>"space"</em> information <em>"space"</em> message</p>
  
  <p>Expected HTML report</p>
  
  <p><img src="https://i.stack.imgur.com/tcGdW.jpg" alt="enter image description here"></p>
  
  <p>At the moment I could thought of creating txt file with Header, footer tags &amp; table tags. And Adding  tags in the begining and the end of lines. But am struggling to those tags in the lines for different targerted columns. We cannot replace all spaces with  tags because there spaces in the Message description. Can you please suggest any new approach or any suggestion on below tried code.</p>
  
  <pre><code>    #include "stdafx.h"    
      #include &lt;string&gt;
      #include &lt;fstream&gt;
      #include &lt;iostream&gt;
  
      int main()
      {
          std::ifstream inputFile("C:\\Test\\log.txt");
          std::ofstream outputFile("C:\\Test\\Report.txt");
  
          std::string line;
          while (std::getline(inputFile, line))
              outputFile &lt;&lt; "&lt;tr&gt;&lt;td&gt; " &lt;&lt; line &lt;&lt; " &lt;/tr&gt;&lt;/td&gt;"&lt;&lt; std::endl;
  
          return 0;
      }
  </code></pre>