我的程序里是这样生成INI文件的: 在CWinApp派生类的InitInstance()函数的一开始,调用以下函数: //The CWinApp destructor will free the memory. free((void*)m_pszProfileName); //Change the name of the .INI file. m_pszProfileName=_tcsdup(_T("c:\\My.ini")); 通过这两行代码,已经把你的INI文件的文件名设置好了。随后,你就可以通过 WriteProfileString()、WriteProfileInt()两个函数向INI文件中写配置了。读的话,用GetProfileString()、GetProfileInt()两个函数实现。
在CWinApp派生类的InitInstance()函数的一开始,调用以下函数:
//The CWinApp destructor will free the memory.
free((void*)m_pszProfileName);
//Change the name of the .INI file.
m_pszProfileName=_tcsdup(_T("c:\\My.ini"));
通过这两行代码,已经把你的INI文件的文件名设置好了。随后,你就可以通过
WriteProfileString()、WriteProfileInt()两个函数向INI文件中写配置了。读的话,用GetProfileString()、GetProfileInt()两个函数实现。