char s[10] = { 0x50, 0x00, 0x30 };
QByteArray array(s, 10); //指定长度,会保留0x00数据(0x50,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00)
QByteArray str(s); //不指定长度,遇到结束符0x00就结束了(0x50)
m_pQSerialPort->write(QByteArray(s, 10));/*写入数据*/
char s[10] = { 0x50, 0x00, 0x30 };
QByteArray array(s, 10); //指定长度,会保留0x00数据(0x50,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00)
QByteArray str(s); //不指定长度,遇到结束符0x00就结束了(0x50)
m_pQSerialPort->write(QByteArray(s, 10));/*写入数据*/