I am trying to read from a .txt file that is formated like:
0,0,80
1,0,65
2,0,20
.
.
.
1000, 10, 70
I am trying to read this data into members of this struct:
struct processData
{
int arrivalTime;
int durationTime;
int completionTime;
int turnAroundTime;
int waitTime;
int processNumber;
float netTurnAroundTime;
} temp;
with this:
processData* aa = new processData[n];
i = 0;
string line;
ifstream job ("job.txt");
if (job.is_open())
{
while (!job.eof())
{
job >> aa[i].processNumber;
job >> aa[i].arrivalTime;
job >> aa[i].durationTime;
i++;
}
job.close();
}
I keep getting a segmentation error and I cannot figure out why this is not working.