title: Diff algorithm C++
body: <p>I'm trying to create a program in C++ that could be able to diff two .txt files.</p>
  
  <pre><code>struct line
  {
      string text;
      size_t num;
      int status;
  };
  
  void compareFiles(vector&lt;line&gt; &amp;buffer_1, vector&lt;line&gt; &amp;buffer_2, size_t index_1, size_t index_2)
  {
      while(index_1 &lt; buffer_1.size())
      {
           while(index_2 &lt; buffer_2.size())
           {  
               X = buffer_1[index_1].text;
               Y = buffer_2[index_2].text;
               if(X == Y)
               {
                   ++index_1;
                   ++index_2;
               }
               else
               {
                   LCS();
                   string lcs = printLCS(X.length(), Y.length());
  
                   /*
                   * Here's my problem
                   */
  
               }
           }
       }
   }
  </code></pre>
  
  <p>As you can see, I have two buffers (vectors of lines) previously loaded with files contents . I also have the LCS algorithm fully functional (tested). LCS works on strings X and Y globally defined.</p>
  
  <p>So, what I really need to do is compare buffers line by line with LCS, but I didn't manage a way to do it.</p>
  
  <p>Could you please help me?</p>