0

I am reading in from a file and when I use .eof() it read everything from the file the I get a run time error of
Exc-Bad-Access. When I run a for loop instead the program runs with not errors. Any hints?

while (!inputFile.eof()) {
		
		inputFile>>number>>lowerRange>>higherRange>>cond>>aFName>>aLName>>phase;
		active=(cond=='t');
		sAds[i] =  SequenceAds(number, lowerRange, higherRange, active, aFName, aLName, phase);
		cout << sAds[i].getCost()<<" "<<sAds[i].getRangeLower()<<"-"<<sAds[i].getRangeHigher()<<" "<<sAds[i].getState()<<" "<<endl;
		i++;
		
	}

here is what is is reading in
45.85 54 74 t Interpublic Group introductory
31.84 20 50 f Mother Advertising end
22.90 18 25 t Pappas Group middle
40.30 65 80 t Omnicom Group end
22.15 50 64 f Grey EMEA introductory

I can include more code it it might help

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by WolfPack
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.