Thanks for the clarification. QSerialPort is derived from QIODevice, whose write(const char *) method indeed writes a NUL-terminated string. In order to specify the number of bytes to write, call the write(const char *, qint64) method instead:
and check the return value to make sure everything was written.Qt Code:
serial->write(panID, sizeof(panID));To copy to clipboard, switch view to plain text mode
Bookmarks