Reading data from file

Ok, I'm running into an issue here. I need to read data from a file into 2 arrays and then do a bubble sort to put in alphabetic order, The bubble sort is no problem, and reading the data would not be a problem either except that some client names and some business types are more than one word, so I probably need to make it a comma separated file as shown below, but can use another method if easier. How can I read these values into 2 arrays?

[Data]
Acme Construction, Machinery design
Johnson Electrical, Switch manufacturing
Brown Heating and Cooling, Boiler design
Smith Switches, Switch manufacturing
Jones Computers, Computer sales
Williams Cleaning Equiptment, Machinery sales

[Code]
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
//**********************************************************************
//loadData method
//**********************************************************************
void Sort::loadData()
{
	clientCt = 0;

	ifstream nameIn;

	nameIn.open ("clientList.dat");          //open dat file
	if (nameIn.is_open())                         //if dat file open
	{
		
		nameIn	>>	clientName[clientCt]  //read first record from file into 2 arrys.                
				>>	businessType[clientCt];

		while (!nameIn.eof())                     //while not end of file(dat)
		{
			++clientCt;			                   //Count the record just read
			
			nameIn	>>	clientName[clientCt]  //read next record from file into 2 arrys.
				    >>	businessType[clientCt];         
		} //END WHILE

		nameIn.close();                           //close dat file
	}//End if file opened

	else	                                       //If file does not open, set the counter to -1
	{
		clientCt = -1;
		cout << "\n\nClient Data File failed to open.";
	}

	return;
}//end loadData method
//********************************************************************** 
Why would you want to put them into two arrays? Perhaps you meant a single, two-dimensional array?
Topic archived. No new replies allowed.