debug fail assertion
下面是可能有错的代码
CString strtime;
CTime time = CTime::GetCurrentTime();
strtime = time.Format("[%H:%M:%S]");
    m_color=0x00000000;
IPstr="127.0.0.1";
sign=FALSE;
CFile MyFile;
MyFile.Open("msg.txt",CFile::modeRead);
    int filelong=0;
filelong=MyFile.GetLength();
char pbuf[1000];
MyFile.Read( pbuf, sizeof( pbuf ) ); 
//if(filelong<256) 
MyFile.Close();
pbuf[filelong]='\0';
IPstr.Empty();
IPstr="";
m_NAME.Empty();
m_NAME="";
int i=2;

while(pbuf[i]!='#')
{
IPstr+=pbuf[i];
i++;
}
i++;
while(pbuf[i]!='#')
{
m_NAME+=pbuf[i];
i++;
}
CFile recordfile,readfile;
recordfile.Open("record.txt",CFile::modeCreate |CFile::modeNoTruncate| CFile::modeReadWrite );

if(pbuf[0]=='1')//说明传递的是消息
{ i++;
while(pbuf[i]!='#')
{
m_Show+=pbuf[i];
i++;
}
        CString rec;
rec=m_NAME+" "+strtime+"\r\n"+m_Show+"\r\n"+"\r\n";
recordfile.SeekToEnd();
recordfile.Write( rec, rec.GetLength()); 
//SetDlgItemText(IDC_SendBTN,"回复消息");
}
//读取记录
    //显示记录
    recordfile.SeekToBegin();
char pbuff[5120];
memset(pbuff,0,5120); 
    recordfile.Read(pbuff,5120);
    recordfile.Close();
m_Show=pbuff;
//IPstr="192.168.1.98";
    
//读取字体 类型和颜色
//读取颜色
CFile Fontfile,colorfiler;
int  colorlong=0;
colorfiler.Open("colortemp.dat",CFile::modeCreate|CFile::modeNoTruncate|
CFile::modeRead);
    colorfiler.Read(&m_color,sizeof(m_color)); 
colorfiler.Close();
//读取字体类型
Font=new CFont;
    Fontfile.Open("Fontemp.dat", CFile::modeCreate|CFile::modeNoTruncate|CFile::modeRead); Fontfile.Read(&m_logft,sizeof(m_logft)); 
Fontfile.Close();
    Font->DeleteObject();
Font->CreateFontIndirect(&m_logft);
    ((CEdit*)GetDlgItem(IDC_TALK))->SetFont(Font,true);
((CEdit*)GetDlgItem(IDC_SHOW))->SetFont(Font,true);
//显示更新
msg.sign=1;
((CEdit *)GetDlgItem(IDC_SHOW))->SetSel(100,100); 
this->UpdateData(false);
m_ServerIPADDRESS.SetWindowText(IPstr);
GetIP_Name();
return TRUE;  // return TRUE  unless you set the focus to a control
}

解决方案 »

  1.   

    看一看你的程序里是不是有ASSERT()或VERIFY()语句。
      

  2.   

    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    是这两行 ASSERT(IDM_ABOUTBOX < 0xF000);
      

  3.   

    这种原因自己找
    我直接结贴了!您好,
    由于您长时间不结贴,上一次答复已超一个月并且已有最佳答案,本人帮你结贴。
    若是觉得答案不嘉,请放在本版的疑难杂症帖链接:
    http://bbs.csdn.net/topics/390351579。
    如果您有什么意见,请您联系我。