Reading a txt file into an array

I have a text file where the first number is the total number of arrays.
The second number in the file is the total amount in the first array.
Each array has a different number of variables.

I know that for loops are my friend here and understand how they work.
However, I am having trouble with the logic to read in from the file.

Suggestions?
The best suggestion that i can give you is looking at the file input/output for the C++ tutorial document.

The exact webpage you want is the following:
http://www.cplusplus.com/doc/tutorial/files/

Please take a look at that.

-Hirokachi
Thank you. Will do.
My output is printing one number less than what is in the size.
Suggestions?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
void loadData(int *values, int &size, fstream &inFile)
{
	string *num;
	int count;

	inFile >> count;
	inFile >> size;

	num = new string[size];

	for(count = 1; count < size; count++)
	{
		inFile >> *(count + num);
	}

	for(count = 1; count < size; count++)
	{
		cout << *(count + num) << " ";
	}

	cout << endl;
	delete [] num;
	count = NULL;
	size = NULL;
}


34 12 6 45 16 10
17 4 9 11 3 17 3 3 20
10 5 6 9 5 10 31 45 10 8 34
17 1 8 16 43 12 65 8 33 12 9 10 45 72 31 3 2 10 33 42 67 55 1 23
9 13 22 90 77 11 20 90 56 43 11 10 10 19

Press any key to continue . . .


This is what is in the input file.
5
7
34
12
6
45
16
10
2
10
17
4
9
11
3
17
3
3
20
22
12
10
5
6
9
5
10
31
45
10
8
34
5
25
17
1
8
16
43
12
65
8
33
12
9
10
45
72
31
3
2
10
33
42
67
55
1
23
33
15
9
13
22
90
77
11
20
90
56
43
11
10
10
19
10
Still can't seem to print out the last number in each array.
If I change the 1 to a 0 in the loop's, the program prints everything in the first array but crashes the program before getting to the next array.
Suggestions?
I'm not sure why the function loadData() is reading both count and size.
Based on the contents of the file, count occurs just once at the start.
pseudocode:
read count
then repeat count times:
    read size
    repeat size times:
        read number



Great input! Thank you. I will look into it and make the adjustment.

Any tips/pointers on writing pseudocode?
I was never really exposed on how to write.
Pseudocode - well, it doesn't necessarily have too many rules.
The main thing is to convey the meaning without getting bogged down in the details of syntax, but it can contain actual code mixed with ordinary English. Mostly the idea is to keep things simple.

Other people may disagree or have other ideas, and that's fine too.
Thank you for your help Chervil. It is much appreciated.
Topic archived. No new replies allowed.