回复 第2楼 b222huang 的帖子
m_SerialPort[0].WriteToPort((LPCTSTR)strTemp);调用下面那个函数
void CSerialPort::WriteToPort(const char* string)
{
assert(m_hComm != 0);
memset(m_szWriteBuffer, 0, sizeof(m_szWriteBuffer));
strcpy(m_szWriteBuffer, string);
m_nWriteSize=strlen(string);
// set event for write
SetEvent(m_hWriteEvent);
}
void CSerialPort::WriteToPort(char* string,int n)
{
assert(m_hComm != 0);
memset(m_szWriteBuffer, 0, sizeof(m_szWriteBuffer));
// memset(m_szWriteBuffer, 0, n);
// strncpy(m_szWriteBuffer, string, n);
memcpy(m_szWriteBuffer, string, n);
m_nWriteSize=n;
// set event for write
SetEvent(m_hWriteEvent);
}
void CSerialPort::WriteToPort(LPCTSTR string,int n)
{
assert(m_hComm != 0);
memset(m_szWriteBuffer, 0, sizeof(m_szWriteBuffer));
// strncpy(m_szWriteBuffer, string, n);
memcpy(m_szWriteBuffer, string, n);
m_nWriteSize=n;
// set event for write
SetEvent(m_hWriteEvent);
}