我用
WritePrivateProfileString
来写ini文件,结果成功了!!但是当我用
GetPrivateProfileInt 或
GetPrivateProfileString
来读ini文件时,数据却读不出来(永远是默认数据),这是为什么呢?最好有具体的实现了的例子。谢谢!
WritePrivateProfileString
来写ini文件,结果成功了!!但是当我用
GetPrivateProfileInt 或
GetPrivateProfileString
来读ini文件时,数据却读不出来(永远是默认数据),这是为什么呢?最好有具体的实现了的例子。谢谢!
[in] Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.
{
int nCount=::GetPrivateProfileInt("StudentCount","Count",0,".\\Student.ini");
for(int i=0;i<nCount;i++)
{
CString StrKeyName,StrStudentName;
StrKeyName.Format("Name %d",i);
::GetPrivateProfileString("studentName",StrKeyName,NULL,StrStudentName.GetBuffer(128),128,".\\Student.ini");}
}