title: Fastest way to load a file, Independent of os
body: <p>The only two requirements I'm limited to is that it must be OS independent and that the data is not saved as binary, I need to save it as text. I've heard of memory mapping, but I'm told I can only use it on windows. Currently, my program's speed is being mainly held back by how fast I can load a file, so any help would be appreciated. So far, this is the best solution I've come to.</p>
  
  <pre><code>std::ifstream file(filepath);
  fileContents.assign(std::istreambuf_iterator&lt;char&gt;(file), std::istreambuf_iterator&lt;char&gt;());
  </code></pre>