Problem Reading Data From A File!

I'm getting stuck reading the input on a file. The ifstream is getting stuck at a specific location (29) and never reads more data. This is an assignment on arrays so it's supposed to be written like this. The first set of parallel arrays will be filled properly, but then no data is read after "95".

Can someone help explain? Thanks!

Provided Data File
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Amy Adams
10111
97 86 78 95
Ben Barr
20222
89 81 73 87
Carla Carr
30333
79 71 63 77
Don Davis
40444
69 62 58 67
Edna Eaton
50555
63 51 62 48


Code Snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
	
	int const DATA_SIZE                 = 5;
	int const SCORE_LENGTH              = 4;
	int const NAME_LENGTH               = 20;
	
	char name[DATA_SIZE][NAME_LENGTH]	= {'\0'};
	char grade[DATA_SIZE]               = {'\0'};
	int id[DATA_SIZE]                   = {0};
	int scores[DATA_SIZE][SCORE_LENGTH] = {0};

	ifstream fileRead;

	fileRead.open(FILENAME);
	
	for(int i=0;i<DATA_SIZE;i++)
	{
		fileRead.getline(name[i], NAME_LENGTH);
		fileRead >> id[i];
		for(int x=0;x<SCORE_LENGTH;x++)
		{
			fileRead >> scores[i][x];
		}
	}
Last edited on
Topic archived. No new replies allowed.