Results 1 to 3 of 3

Thread: how to process hexadecimal

  1. #1
    Join Date
    Oct 2009
    Location
    chennai,india
    Posts
    66
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default how to process hexadecimal

    hi all
    i am creating an application that received and sends data thru serialport.pls see the below code
    Qt Code:
    1. if(comport->bytesAvailable())
    2. {
    3. long count =comport->bytesAvailable();
    4. QByteArray comdata=comport->read(count);
    5. comdata=comdata.toHex();
    6. qDebug()<< comdata;
    7. }
    To copy to clipboard, switch view to plain text mode 
    It displays the ascii value of sent data and displays the hexadecimal value,but i need them
    in array of hexadecimal like below
    byte data[];
    data[0]=0x01;
    data[0]=0xff;
    so that i can check the arrays each position easily ??jus im tired by searching
    can any one help me??
    thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how to process hexadecimal

    Do you mean something like this?:
    Qt Code:
    1. if(comport->bytesAvailable())
    2. {
    3. long count =comport->bytesAvailable();
    4. QByteArray comdata=comport->read(count);
    5. //comdata=comdata.toHex();
    6. //qDebug()<< comdata;
    7. for(int i=0; comdata.size(); i++){
    8. qDebug()<<"data[%d] = "<<i<<" %x"<<comdata[i];
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    mohanakrishnan (20th November 2009)

  4. #3
    Join Date
    Oct 2009
    Location
    chennai,india
    Posts
    66
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to process hexadecimal

    hi
    i hav tried it and accessed the hexadecimals.
    thanks for ur help
    ....

Similar Threads

  1. How to communicate Qt Process with non-qt process
    By nrabara in forum Qt for Embedded and Mobile
    Replies: 9
    Last Post: 15th February 2009, 21:01
  2. Process Read/Write
    By QbelcorT in forum Newbie
    Replies: 0
    Last Post: 20th November 2008, 03:08
  3. Problem executing process
    By EricF in forum Qt Programming
    Replies: 4
    Last Post: 25th January 2008, 16:04
  4. Send a key to process
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2007, 17:37
  5. How to activate another process?
    By gtthang in forum Qt Programming
    Replies: 6
    Last Post: 3rd February 2006, 07:53

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.