16boke - 一路博客

C++读写ini

/*例子:

D:\\config.ini内容

[Email]

UserName=

PassWord=

*/

char szUser[1024] = {};
char szPassword[1024] = {};
::GetPrivateProfileStringA("Email","UserName","",szUser,1024,"D:\\config.ini");
::GetPrivateProfileStringA("Email","PassWord","",szPassword,1024,"D:\\config.ini");
::WritePrivateProfileStringA("Email","UserName","test","D:\\config.ini");
::WritePrivateProfileStringA("Email","PassWord","123","D:\\config.ini");