Help with a function

I'm trying to get this function to read from a file and give back the number of "orderitems." Any Idea how I would do something like this, also I get the error not all control paths return a value.

here is an example of what is in the file

"Stromboli 1 Mon JohnBundonisA2"

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
50
51
52
53
54
55
56
57
58
59
60
61
double ReadOrders (ifstream& ifile, orders * pt)
{
		
	//string orderitem, quantity, date, customer;
	//int i=0;

	//while (ifile >> orderitem >> quantity >> date >> customer)
	//{
		
		//cout << i << "order of " << quantity << itemname2 << " by" << name << " on" << date;
		//order starts below
	
	orders readorders[MAXELS];
	int i = 0;

	string filename;
	filename = "orders.txt";
	ifstream inFile;


	orders *orderptr;
	   
    try
	{

			inFile.open(filename); // open the file
			if (inFile.fail())
			{
				   cout << "Your input file was not opened!" << endl;
				   cin.ignore();
				   throw filename;
			}
			else
			{
				  cout << "Your input file was opened!" << endl;
				  cin.ignore();
			
				 orderptr = readorders;
				  ReadOrders(inFile, orderptr);	              
        

				  //for(i=0;i < MAXELS; ++i)
				  //{
			//			cout << "The programming assignment average for " << itemname << endl;
				//  }


			} // FILE WAS OPENED

	} // TRY

	catch(string err)
		{
			cout << "The file : " << err << " was not opened." << endl;
			cout << "Please check that the file exists. " << endl;
			system("pause");
			exit(1);
		}
	}

Topic archived. No new replies allowed.