这是我写的打开串口的程序,编译时出现Debug Assertion Failed!!求大神指教!
void CMy413Dlg::OnBtnOpencom() {
/// TODO: Add your control notification handler code here
CSerialPort g_SerialPort;
CString str;
GetDlgItemText(IDC_EDIT_COM,str);
int i = atoi(str);
GetDlgItemText(IDC_BTN_OPENCOM,str);
if (str == "打开串口")
{
//打开串口
if(g_SerialPort.InitPort(this,i,1000000,'N',8,1,EV_RXFLAG | EV_RXCHAR,512))
{
g_SerialPort.StartMonitoring();
m_bPortOpened = TRUE;
SetDlgItemText(IDC_BTN_OPENCOM,"关闭串口");
m_Icon.SetIcon(m_hIconOn);
}
else
MessageBox("没有发现串口或被占用","提示");
}
else
{
g_SerialPort.ClosePort();
m_bPortOpened = FALSE;
SetDlgItemText(IDC_BTN_OPENCOM,"打开串口");
m_Icon.SetIcon(m_hIconOFF);
}//*/
}
这是我写的打开串口的程序,编译时出现Debug Assertion Failed!!求大神指教!不胜感激!