Results 1 to 20 of 121

Thread: dynamicCall and QByteArray - strange characters

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: dynamicCall and QByteArray - strange characters

    Quote Originally Posted by franco.amato View Post
    Wysota how can I do to convert from bigendian some bytes of the qbytearray?
    For example I would convert from bigendian the bytes from ba[14] to ba[28] ( 15 bytes ).

    I did this
    Qt Code:
    1. char* name = new char[15];
    2. memcpy( name, &ba[14], sizeof(char)*15); //I copy 15 bytes of ba to name
    3. char* name_converted = new char[15];
    4. name_converted = qFromBigEndian(name);
    To copy to clipboard, switch view to plain text mode 

    now I would convert from bigendian the content of name to display the name.
    but the qFromBigEndian doesn't return as value a char[] so I can not display correct a name
    qFromBigEndian() is a template function and returns type given in template call.

    But... Can you name a type which has a 15 bytes?? I don't know such type... they rather have 2^n bytes, so what type do you want to get?
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  2. #2
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    694
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: dynamicCall and QByteArray - strange characters

    Quote Originally Posted by faldżip View Post
    qFromBigEndian() is a template function and returns type given in template call.

    But... Can you name a type which has a 15 bytes?? I don't know such type... they rather have 2^n bytes, so what type do you want to get?
    I only would convert an undefined number of bytes
    Franco Amato

Similar Threads

  1. Replies: 0
    Last Post: 16th April 2010, 23:21
  2. Regarding qbytearray
    By mohanakrishnan in forum Qt Programming
    Replies: 7
    Last Post: 19th November 2009, 13:38
  3. Replies: 9
    Last Post: 25th July 2009, 13:27
  4. Replies: 1
    Last Post: 28th May 2008, 16:52
  5. QByteArray in Qt3
    By joseph in forum Qt Programming
    Replies: 1
    Last Post: 6th September 2007, 06:16

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.