0

So I'm trying to loop and read in values from my csv while there are values to be read. What do I use for the while condition?

I tried all manner of things.....

void load()
{//read from file
	ifstream inFile("csv.txt");
	string line;
	
	if(inFile.is_open())
	{
	}
	else
	{
		cout << "Error opening file!" << endl;
	}
	
	while()
		{
			aircraft temp;
			stringstream stream(line);
			stream >> temp.serial;
			stream.ignore ( std::numeric_limits<std::streamsize>::max(), ',' );
			getline(stream,temp.name,',');
			stream.ignore ( std::numeric_limits<std::streamsize>::max(), ',' );
			getline(stream,temp.manufacturer, ',');
			stream >> temp.registration;
			stream.ignore ( std::numeric_limits<std::streamsize>::max(), ',' );
			getline(stream,temp.owner, ',');
			getline(stream,temp.productionDate, ',');
			getline(stream,temp.stdInspection, ',');
			getline(stream,temp.extraInspection, ',');
			mainList.push_front(temp);						
		}
		
		inFile.close();
	
}
3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by NathanOliver
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.