infile arrays

How would one infile an array of numbers from a .txt file? i am trying to make a subprogram that infiles data stored in a .txt file and slightly edits the data based on the result of the program, without changing anything else.

This is what I currently have, it is printing the edited results, however, it is erasing all previous data and restoring it to 0.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  void record(){
	ifstream infile;
	infile.open("Balance.txt");

	j = 0;

	while (j < 12){

		k = 0;

		while (k < 12){
			infile >> matchup[k][j]; /* this is probably where my error is, I'm not sure how to infile a specific location of a .txt file*/
			k++;
			

		}
		j++;
	}
	

	infile.close();

	matchwin = matchwin - 1;
	matchloose = matchloose - 1;

	matchup[matchloose][matchwin]++;

	ofstream outfile;

	outfile.open("Balance.txt");

	j = 0;

	while (j < 12){

		k = 0;

		while (k < 12){
			outfile << matchup[k][j];
			k++;

		}
		outfile << endl;
		j++;
		cout << endl;
	}

	outfile.close();
}
Topic archived. No new replies allowed.