[VC++]配置文件读取
2012-01-12 13:43 三犬风 阅读(459) 评论(0) 编辑 收藏 举报1.读取VALUE为字符串
DWORD dwRet = 0;
GetCurrentDirectory(MAX_PATH,currentPath);
wsprintf(currentPath,_T("%s%s"),currentPath,iniFile);
dwRet = GetPrivateProfileString(_T("SECTION"),_T("KEY"),NULL,strIP,LenIPBuffer,currentPath);
if (0 == dwRet)
{
return READ_INI_FAILED;
}
2.读取VALUE为整形
VALUE = GetPrivateProfileInt(_T("SECTION"),_T("KEY"),NULL,currentPath);
if (0 == VALUE )
{
return READ_INI_FAILED;
}
Always go with the choice that scares you the most, because that's the one that is going to require the most from you!