VC读配置文件实例
本文实例讲述了VC读配置文件的方法,分享给大家供大家参考。具体实现方法如下:
charszBugCC[4096]={0};
intnRet=GetPrivateProfileSection("Setting",szBugCC,sizeof(szBugCC),BugConfig.c_str());
if(nRet>0)
{
//过滤/0/0/00
DWORDdwIndex=0;
charszTemp[128]={0};
while(dwIndex<nRet)
{
strcpy(szTemp,szBugCC+dwIndex);
//szTemp"11=11@163.com"
CStringstrTemp(szTemp);
intnPos=strTemp.Find("=");
m_combo_bugcc.AddString(strTemp.Left(nPos));
dwIndex+=strlen(szTemp);
dwIndex++;
}
}
配置文件格式:
[Setting] 11=11@163.cn 22=22@163.cn ope=0.cn
希望本文所述对大家的VC程序设计有所帮助。