title: How to copy a .txt file to a char array in c++
body: <p>Im trying to copy a whole .txt file into a char array. My code works but it leaves out the white spaces. So for example if my .txt file reads "I Like Pie" and i copy it to myArray, if i cout my array using a for loop i get "ILikePie"</p>
  
  <p>Here is my code</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main () 
  {
    int arraysize = 100000;
    char myArray[arraysize];
    char current_char;
    int num_characters = 0;
    int i = 0;
  
    ifstream myfile ("FileReadExample.cpp");
  
       if (myfile.is_open())
          {
            while ( !myfile.eof())
            {
                  myfile &gt;&gt; myArray[i];
                  i++;
                  num_characters ++;
            }      
  
   for (int i = 0; i &lt;= num_characters; i++)
        {
  
           cout &lt;&lt; myArray[i];
        } 
  
        system("pause");
      }
  </code></pre>
  
  <p>any suggestions? :/</p>