本帖最后由 jxlyyr3 于 2011-9-20 22:07 编辑
各位大师好,我是刚学c++的,在论坛高手的指导下,编写了一个mfc读取的程序,程序如下:
LONG CSerialPortTestDlg::OnComm(WPARAM ch, LPARAM port)
{
INT temp;
// UINT Hbyte,Lbyte;
//INT i=0;
i++;
if (i==1)
{
Hbyte=ch;
}
if (i==2)
{
Lbyte=ch;
temp = Hbyte;
temp = temp << 8; //高八位
temp |= Lbyte; //低八位
CString hexCh;
hexCh.Format(TEXT("%.2f "), ((temp*10.0/4095.0-5.0)*1000.0*3/5.0));
m_strEditReceiveMsg = hexCh;
i=0;
}
UpdateData(FALSE);
CFile file;
file.Open( "D:\\1.txt ",CFile::modeReadWrite);
CString str = _T( " ");
m_Edit.GetWindowText(str);//编辑框控件的control的绑定变量
file.Write(str,str.GetLength());
file.Close();
编译的时候没有错误,点击调式后,弹出错误:
提示For information on how your program cause an assertion failure,See the visual c++ documation on asserts.
File:filecore.cpp
求高手指导
Line:238 |