Results 1 to 5 of 5

Thread: Trouble with CRC-32 function

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Trouble with CRC-32 function

    Here is a couple of ways (there are probably many of varying efficiency):
    Qt Code:
    1. quint32 crc = 0x00123456;
    2. QByteArray result = QByteArray::number(crc, 16);
    3. result.prepend("00000000");
    4. result = result.right(8);
    5. qDebug() << result;
    6.  
    7. result = QByteArray::number(crc, 16);
    8. result = result.rightJustified(8, '0', false);
    9. qDebug() << result;
    10.  
    11. // condense the previous to
    12. result = QByteArray::number(crc, 16).rightJustified(8, '0', false);
    13. qDebug() << result;
    To copy to clipboard, switch view to plain text mode 
    or you could use QString::arg() and an appropriate set of parameters and have a QString return.

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

    Sölve (25th October 2010)

Similar Threads

  1. Replies: 2
    Last Post: 13th September 2010, 21:03
  2. Replies: 3
    Last Post: 25th May 2010, 10:46
  3. Replies: 0
    Last Post: 10th March 2010, 09:13
  4. SQL trouble
    By xmeister in forum Newbie
    Replies: 2
    Last Post: 25th March 2009, 12:53
  5. New to QT..need help guys..sorry for the trouble
    By neomax in forum General Discussion
    Replies: 2
    Last Post: 17th November 2006, 17:20

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.