您的位置:首页 > 其它

VC读配置文件实例

2018-10-12 14:09 405 查看

本文实例讲述了VC读配置文件的方法,分享给大家供大家参考。具体实现方法如下:

char szBugCC[4096]={0};  
int nRet = GetPrivateProfileSection("Setting", szBugCC, sizeof(szBugCC), BugConfig.c_str()); 
if (nRet > 0) 

        //过滤/0 /0 /00 
        DWORD dwIndex = 0; 
        char szTemp[128]={0}; 
        while (dwIndex < nRet) 
        { 
            strcpy(szTemp, szBugCC+dwIndex); 
            //szTemp "11=11@163.com" 
            CString strTemp(szTemp); 
            int nPos = 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程序设计有所帮助。

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: