Beispiel #1
0
void FileHandler::saveRoomList(string fname, RoomList& r_list)
{
	// open file
	ofstream fout;
	fout.open(fname);
	if (!fout)
	{
		cerr << "\n" << "can't open file!!";
		exit(1);
	}

	// save data into file
	int count = r_list.getCount();
	for (int i = 0; i<count; i++)
	{
		Room r = r_list.getRoomList(i);
		fout << r.room_no << " " << r.room_type << " " << r.sex << " " << r.max_patient << " " << r.current_patient << endl;
	}

	// close file
	fout.close();
}