VC/MFC MFC中保存ini配置文件,代码片段

//在xxxApp::InitInstance()函数里面添加以下内容
delete m_pszProfileName;
delete m_pszRegistryKey;
m_pszRegistryKey = NULL;	//如果不为空则会把配置存在注册表里面
m_pszProfileName = _wcsdup(L"./config.ini");//ini文件路径,可以修改为绝对路径

然后就可以使用这一类函数来读写配置了

GetProfileInt(L"Section", L"Name",nValue);

WriteProfileInt(L"Section", L"Name", nValue);