Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool list::ReadFromDisk(void) {
- ifstream codes("launch-codes");
- while (codes) {
- string s;
- if (!getline(codes, s)) break;
- istringstream ss(s);
- while (ss) {
- Winery* obj = new Winery;
- string s;
- if (!getline(ss, s, ',')) break;
- obj->setName(s.c_str());
- if (!getline(ss, s, ',')) break;
- obj->setLocation(s.c_str());
- if (!getline(ss, s, ',')) break;
- obj->setAcre(atoi(s.c_str()));
- if (!getline(ss, s, ',')) break;
- obj->setRating(atoi(s.c_str()));
- if (!getline(ss, s, ',')) break;
- obj->setYear(atoi(s.c_str()));
- this->insert(*obj);
- delete obj;
- }
- }
- if (!codes.eof()) {
- cerr << "Error!\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement