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
|
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();
}
|