在VC中读写INI文件相对比较简单,读INI文件我们只需用到GetPrivateProfileString系统API,而写INI文件也只需用到WritePrivateProfileString系统API,他们的使用例子如下:
读:
CString strCaption;
GetPrivateProfileString("Form",
"Caption",
"Default Caption",
strCaption.GetBuffer(MAX_PATH),
MAX_PATH,
"./Test.ini");
写:
WritePrivateProfileString("Form",
"Caption",
"MyCaption",
"./Test.ini");