Have a close look on what are you doing.
In the loop at line 12, you read each line in one iteration to the std::string
line.
Now you iterate a for loop nested inside the while loop and assign all the element of
file[] the same content:
line
You do not need two loops. You can eliminate the while loop. A for loop is enough.
Heres a hint:
for (int i=0; std::getline(inFileStream,line); i++)//reads the next line to the variable line till the end of the file.
Reputation Points: 1486
Solved Threads: 140
Practically a Posting Shark
Offline 816 posts
since Oct 2007