evc 串口函数 打出“回车”
我的串口程序中,打印出来的字符时一句接一句,想打出一句后输出一个 回车 ,就是换行,不知道要怎么加?
我的显示程序如下:
- C/C++ code
void CALLBACK CSerialPortDlg::OnCommRecv(CWnd* pWnd, char *buf, int buflen){ CString tmp; CSerialPortDlg * pDlg = (CSerialPortDlg*)pWnd; CEdit *pRecvStrEdit = (CEdit*)pDlg->GetDlgItem(IDC_REC_DISP); /* 取得控件指针 */ for (int i = 0; i < buflen; i++, buf++) { tmp.Format(_T("%c"), *buf); /* 将字符转换为字符串 */ pDlg->m_strRecDisp += tmp; } pRecvStrEdit->SetWindowText(pDlg->m_strRecDisp); /* 显示在窗口上 */}[解决办法]
_T("\r\n") 回车换行