void FileHandler::loadRoomList(string fname, RoomList& r_list) { // open file ifstream fin; fin.open(fname, ios_base::in); if (!fin) { cerr << "\n" << "can't open file!!"; return; } // read data from file Room r; while (!fin.eof()) // read data { fin >> r.room_no >> r.room_type >> r.sex >> r.max_patient >> r.current_patient; r_list.insertRoom(r); } // close file fin.close(); }
void FileHandler::loadRoomList(string fname, RoomList& r_list) { // open file ifstream fin; fin.open(fname); if (!fin) { cerr << "\n" << "can't open " << fname << "!!"; return; } // read data from file Room r; while (!fin.eof()) // read data { fin >> r.room_no >> r.room_type >> r.sex >> r.capacity >> r.p_count; r_list.insertRoom(r); } // close file fin.close(); }