BOOL CAdressBookCtrl::SaveRecord()
{
ofstream fout("record.txt");
//保存一共有多少条记录
fout << m_Count << endl;
for (int i =0 ;i < m_Count; i++)
{
//每天条记录保存一行
fout << m_AdressBookInfo[i].sName.c_str() << " " << m_AdressBookInfo[i].sPhone.c_str() << endl;
}
fout.close();
return TRUE;
}
BOOL CAdressBookCtrl::LoadRecord()
{
ifstream fin("record.txt");
//先获取通讯录个数
fin >> m_Count;
for (int i =0; i < m_Count; i++)
{
//一次加载每条通讯录
fin >> m_AdressBookInfo[i].sName >> m_AdressBookInfo[i].sPhone;
}
fin.close();
return TRUE;
}
{
ofstream fout("record.txt");
//保存一共有多少条记录
fout << m_Count << endl;
for (int i =0 ;i < m_Count; i++)
{
//每天条记录保存一行
fout << m_AdressBookInfo[i].sName.c_str() << " " << m_AdressBookInfo[i].sPhone.c_str() << endl;
}
fout.close();
return TRUE;
}
BOOL CAdressBookCtrl::LoadRecord()
{
ifstream fin("record.txt");
//先获取通讯录个数
fin >> m_Count;
for (int i =0; i < m_Count; i++)
{
//一次加载每条通讯录
fin >> m_AdressBookInfo[i].sName >> m_AdressBookInfo[i].sPhone;
}
fin.close();
return TRUE;
}