bool Product::read(fstream& fs) { getline(fs, name); if (name == "") return false; // End of file fs >> price >> score; if (fs.fail()) throw runtime_error("Error while reading product"); string remainder; getline(fs, remainder); return true; }