Results 1 to 15 of 15

Thread: [ SOLVED (kinda) ]copy structure to QByteArray

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    107
    Thanks
    36
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Red face [ SOLVED (kinda) ]copy structure to QByteArray

    Hi,

    I'm trying to copy this structure to a QByteArray:

    Qt Code:
    1. typedef struct
    2. {
    3. quint32 status_change_id;
    4. bool result_code; // true if sucessful, false otherwise
    5. quint8 reserved[3]; /* Set to 0 */
    6. } driver_id_receipt_data_type;
    To copy to clipboard, switch view to plain text mode 

    The structure already being declared and filled with:

    Qt Code:
    1. driver_id_receipt_data_type receipt;
    2. receipt.status_change_id = payload.mid(2,4).toUInt();
    3. receipt.result_code = true;
    4. receipt.reserved[0] = 0;
    5. receipt.reserved[1] = 0;
    6. receipt.reserved[2] = 0;
    To copy to clipboard, switch view to plain text mode 

    Every approach I use (cast to (char *), ::fromRawData(), etc) I stumble upon the impossibility of reaching the desired goal...

    Is there a way of doing this?

    Any help appreciated
    Best regards,
    Pedro Doria Meunier
    Last edited by pdoria; 13th October 2009 at 14:07. Reason: SOLVED (kinda)

Similar Threads

  1. Replies: 1
    Last Post: 27th November 2014, 09:11
  2. How to copy sellected ellipse area from image
    By adamsakli in forum Newbie
    Replies: 2
    Last Post: 24th September 2009, 22:11
  3. How to copy selected ellipse area from image
    By adamsakli in forum Qt Programming
    Replies: 5
    Last Post: 24th September 2009, 19:54
  4. QByteArray problem
    By Misenko in forum Qt Programming
    Replies: 17
    Last Post: 4th October 2008, 21:53
  5. Replies: 1
    Last Post: 1st March 2006, 11:43

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.