I'm reading from a file, the first line is already used before this, but lines 2-5 I need to be printed. This program crashes after it prints the 5th line and I'm having trouble figuring out why.
This is what it says when I debug it: "Unhandled exception at 0x010A98E6 in CA2.exe: 0xC0000005: Access violation writing location 0xCCCCCCCC."
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
string line; //line from file
string array[5]; //array each line is stored in
int loop =0; //line counter??
while (inFile)
{
cout << endl << "\n ";
while (!inFile.eof())
{
getline(inFile,line);
array[loop] = line;
cout << line << endl;
loop++;
}
}