title: C# File.ReadAllBytes vs std::ifstream (Windows)
body: <p>In C# and C++ reading in all bytes from a network file give massively different results. C++ is taking close to three times as long as C#</p>
  
  <p>C#</p>
  
  <pre><code>File.ReadAllBytes(filepath);
  </code></pre>
  
  <p>C++</p>
  
  <pre><code>std::ifstream str_in(fp, std::ifstream::binary);
  
  int data_rem = fs_len;
  int data_read = 0;
  
  while (data_rem&gt;0)
  {
      str_in.read(buffer+ data_read, 1024*1024*1);
      data_rem -= str_in.gcount();
      data_read += str_in.gcount();
  }
  </code></pre>
  
  <p>Using the C struct FILE gave the same results as C++</p>