Convert files into string array C++
<p>I need to read a file and turn it into a string array but when it reads the file it doesn't put anything in the array.
Here's my current code:</p>

<pre><code>string code[200];
string name;
int lines;
string filename;
int readfile(){
  ifstream inFile;
  int counter = 0;
  cout &lt;&lt; "Which file would you like to open?\n";
  cin &gt;&gt; filename;
  countlines();//counts total lines of file
  inFile.open(filename);
  if(inFile.fail())
  {
    cout &lt;&lt; "File did not open correctly, please check it\n";
    system("pause");
    exit(0);
    //return 1;
  }
  inFile &gt;&gt; name;
  for (int i=0;i &lt; lines; i++)
  {
    inFile &gt;&gt; code[i];
    if (!inFile)
      cout &lt;&lt; "Error" &lt;&lt; endl;
    break;
  }
  inFile.close();
  cout &lt;&lt; "Now opened: " &lt;&lt; name &lt;&lt; endl;
  return 0;
}
</code></pre>
