void CMyDlg::WriteProfileToIni()
{
CString strValue;
strValue.Format(TEXT("%d"), 000);
::WritePrivateProfileString(TEXT("sectionName"), TEXT("key1"), strValue, m_iniFilePath);
strValue.Format(TEXT("%d"), 111);
::WritePrivateProfileString(TEXT("sectionName"), TEXT("key2"), strValue, m_iniFilePath);
}
void DlgCompareEtabs::ReadProfileFromIni()
{
//获取 int
m_iniValue1 = ::GetPrivateProfileInt(TEXT("sectionName"), TEXT("key1"), 1, m_iniFilePath);
m_iniValue2 = ::GetPrivateProfileInt(TEXT("sectionName"), TEXT("key2"), 1, m_iniFilePath);
//获取 CString
GetDataBasePath(); ::GetPrivateProfileString(TEXT("sectionName"),TEXT("m_strPath"),TEXT("C:\\Users\\myComputer\\Desktop"),m_strPath.GetBuffer(MAX_INI_STRLENTH),
MAX_INI_STRLENTH, m_iniFilePath);
m_strPath.ReleaseBuffer();
}
C++读写 ini 文件
最新推荐文章于 2024-04-17 09:23:29 发布