Results 1 to 5 of 5

Thread: serial port command doesn't work

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: serial port command doesn't work

    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:
    Qt Code:
    1. serial->write(panID, sizeof(panID));
    To copy to clipboard, switch view to plain text mode 
    and check the return value to make sure everything was written.

  2. The following user says thank you to yeye_olive for this useful post:

    hovuquocan1997 (20th July 2015)

  3. #2
    Join Date
    Jul 2015
    Posts
    18
    Thanks
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: serial port command doesn't work

    Thank you very much! It worked! I really appreciate your help, my time was running out and you saved my life.

Similar Threads

  1. Serial read misses to read data from the serial port
    By mania in forum Qt for Embedded and Mobile
    Replies: 11
    Last Post: 18th August 2014, 08:49
  2. Replies: 0
    Last Post: 6th March 2014, 07:38
  3. qt serial port
    By saman_artorious in forum Newbie
    Replies: 9
    Last Post: 24th April 2013, 16:19
  4. Replies: 12
    Last Post: 19th July 2012, 21:22
  5. Serial Port
    By b1 in forum Qt Programming
    Replies: 2
    Last Post: 18th January 2007, 02:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.