void DIALOG1::SetListValue(int Cname, CString AppName, CString KeyName, CString FileName)
{
int i;
    CString sReceiveBuf[50];
for(i=0;i<=m_Listgroundrun.GetCount();i++)
{
CString temp[50],KeyNamep[50];
                  temp[i].Format("%d",i);
KeyNamep[i]=KeyName+temp[i];
m_Listgroundrun.GetText(i,sReceiveBuf[i]);
WritePrivateProfileString(AppName,KeyNamep[i],sReceiveBuf[i],FileName);
}}void DIALOG1::SaveValuedlg1()
{
SetListValue(IDC_LIST1,"DIALOG1","DIALOG1list",filepath);
}
这段代码是用来实现把列表框控件中的内容写入ini文件的,帮忙看看有什么问题呀,怎么不出结果?
我想实现的是程序自己判断List中有多少项,在把各项写入ini,起的KeyName是 SetListValue中起的名字+数字.

解决方案 »

  1.   

    >m_Listgroundrun.GetText(i,sReceiveBuf[i]);
    ----------------------------
    应为 m_Listgroundrun.GetText(i, &sReceiveBuf[i]);
      

  2.   

    不对呀,现在编译没问题但是运行的时候出现一个对话框
       上面说:
             Debug Assertion Failed!
             
             Program:D:\Mpart\Debug\Mpart.exe
             File: strcore.cpp
             Line:519         For information on how your program can cause an assertion
             failure,see the Visual C++ documentation on asserts.         (Press Retry to debug the application)
    这样的错误!
       怎么解决呀?