Help with output to file

hi guys, i have a issue with my program being able to write a .dat file

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
int main()
{
	JB *hL = new JB[10];
	while (y == 9)
	{		
		highList[y] = highest;
	}

	writeFile(highList, y);
        return 0;

}

void JB :: writeFile(JB[]& highList[] , int y)
{
	string filename = "BJ.dat";
	ofstream outFile;
	outFile.open (BJ.dat);

	if (outFile.fail ())
	{
		cout << "The file was not successfully opened" <<  endl;
	}
	outFile << "Highest Job Bids" << endl;
	
	for (int i = 0; i < y; i++)
	{
	outFile  << hL[y] << endl; 
	}
	outFile << "The number of Job Bids is " << y << endl;
	outFile.close();

	cout << "The file " << filename << " has been successfully written." << endl;
}


the problem is i dun know how to handle the array inside the function. and i also do not know how am i suppose to call the function in the main.

note : JB is a class
Topic archived. No new replies allowed.