Results 1 to 6 of 6

Thread: QDataStream to QByteArray and ViceVersa

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default QDataStream to QByteArray and ViceVersa

    Qt Code:
    1. QByteArray data = QByteArray::fromHex("200000008305370FFFFFF630500008E");
    2. QDataStream dataStreamToReadFrom(&data, QIODevice::ReadOnly);
    3. QByteArray convertedData;
    4. dataStreamToReadFrom >> convertedData;
    5.  
    6. QString Str = data.toHex();
    7. QString convertedStr = convertedData.toHex();
    To copy to clipboard, switch view to plain text mode 

    Here Str and convertedStr are not same. Why?

    I want to bothe QByteArray data and converted Data to be the same. How to achieve that.?
    Last edited by d_stranz; 24th March 2021 at 20:12. Reason: missing [code] tags

Similar Threads

  1. Help with QDataStream and QByteArray
    By P@u1 in forum Qt Programming
    Replies: 1
    Last Post: 28th June 2011, 00:25
  2. QByteArray,QDataStream Question
    By aash_89 in forum Qt Programming
    Replies: 3
    Last Post: 21st July 2010, 21:40
  3. QTcpSocket QDataStream QByteArray
    By Grimlock in forum Newbie
    Replies: 1
    Last Post: 14th December 2009, 22:47
  4. Replies: 9
    Last Post: 25th July 2009, 13:27
  5. how QDataStream and QByteArray related
    By dognzhe in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2009, 08:45

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