title: In C++, what's the fastest way to tell whether two string or binary files are different?
body: <p>I'm writing a unit test and need to compare a result file to a golden file. What's the easiest way to do so?</p>
  
  <p>So far I have (for Linux environment):</p>
  
  <pre><code>int result = system("diff file1 file2");
  </code></pre>
  
  <p>They are different if <code>result != 0</code></p>