int main() { person persona[MAX_PERSON]; int num = 0, choice = 1; DisplayMenu(); while (choice != 0) { cout << endl << "Enter command: "; cin >> choice; while (cin.fail()) { cout << "Invalid input, enter number 0-7:"; cin.clear(); cin.ignore(256, '\n'); cin >> choice; } if (choice == 0) { cout << "Goodbye" << endl; return 0; } if (choice == 1) DisplayMenu(); if (choice == 2) AddPerson(persona, &num); if (choice == 3) PrintPerson(persona, num); if (choice == 4) PrintAllPersons(persona, num); if (choice == 5) DeletePerson(persona, &num); if (choice == 6) ExportToFile(persona, num); if (choice == 7) ImportFromFile(persona, &num); } return 0; }
void CDlgData::OnSaveFile() { CFileDialog fdlg(false,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,"Hex Data Files(*.hex)|*.hex|All Files(*.*)|*.*||",NULL); if(fdlg.DoModal()==IDOK) { CString m_strDesFile=fdlg.GetPathName(); m_strDesFile.TrimRight(); if (m_strDesFile.Right(4).Compare(".hex")!=0) { m_strDesFile+=".hex"; } ExportToFile(m_strDesFile); } }