title: How to write data to a given serial port with qt?
body: <pre><code>#include &lt;QSerialPort&gt;
  #include &lt;QSerialPortInfo&gt;
  int main(int argc, char *argv[])
  {
      QCoreApplication a(argc, argv);
  
      // Example use QSerialPortInfo
      foreach(const QSerialPortInfo &amp;info, QSerialPortInfo::availablePorts()) {
  
          // Example use QSerialPort
          QSerialPort serial;
          serial.setPort(info);
          if (serial.open(QIODevice::ReadWrite))
               //I try to send a string of hexadecimal numbers，seems not right
              //serial.write(QByteArray("0xFF010100FFFFFF"));
              serial.close();
      }
  
      return a.exec();
  }
  </code></pre>
  
  <p>The example above shows how to open all available serial ports and then close them. But I want to open a given serial port, such as COM6, set its BaudRate,DataBits,Parity,StopBits ,FlowControl and then send a string of hexadecimal numbers. </p>