title: Save strings from text file into array c++
body: <p>My text file is like</p>
  
  <pre><code>Alex Garcia 1000 userid password
  Sana Lopez 300 uid pwd
  </code></pre>
  
  <p>I am trying to save above text file in 2D array</p>
  
  <pre><code>ifstream Records("customerdata.txt");
  string dataarray[6][6];
  
      if (Records.is_open())
       {
           while ( Records.good() )
              {
                  for(int i=0; i&lt;6; i++)
                  {
                      for(int j=0; j&lt;6; j++)
                      {
                          getline(Records,dataarray[i][j],' ');
  
                      }
  
  
                  }
              }
          Records.close();
      }
       else cout &lt;&lt; "Unable to open file"; 
  </code></pre>
  
  <p>When I try to output array using for loop I get some values missing. I dont know what I am doing wrong.</p>