title: Fastest get file content function in c++ and detect binary or text auto
body: <p>Hello i am using this function to get files content in c++</p>
  
  <pre><code>        // Create buffer
          ostringstream Buffer;
  
          // Set handler
          ifstream Handler(Path, ios::in);
  
          // Get lines
          Buffer &lt;&lt; Handler.rdbuf();
  
          // Return
          return Buffer.str();
  </code></pre>
  
  <p>But i have 2 problems with this function<br><br>
  1 - This function is very slow and when i compere it with <code>file_get_content</code> in php, php function is about <strong>15x</strong> faster</p>
  
  <p>2 - For binrary i have to change this function and use <code>(ios::binary)</code> so there is no way that this function detect file is text or binary and i have to do this myself ...</p>
  
  <p>now i need a function to get files content (fastest) function and can detect file is text or binary and use the true action ....</p>