Results 1 to 5 of 5

Thread: What is the format of QByteArray's storage?

  1. #1
    Join Date
    Jul 2007
    Posts
    25
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default What is the format of QByteArray's storage?

    Hi all,

    In my application, I'm storing a character string into a QByteArray, I want to know whether the QbyteArray, storing signed data or a unsigned data??
    (considering the fact that, there are extended character set of having ASCII value more than 127, which can drastically affect the characters getting saved into the QByteArray)

    Thanks and Regards

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is the format of QByteArray's storage?

    QByteArray has no support for that, it just stores raw data, but you can just test a byte. If it is greater than 127 or not.

  3. #3
    Join Date
    Jul 2007
    Posts
    25
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: What is the format of QByteArray's storage?

    Thanks for the reply marcel.
    but I guess the question was not clear enough, actually I'm not at all checking whether the QByteArray storing the byte in signed or unsinged way, I just wanted to know how does the Qbytearray store the data, whether in signed format or unsigned format?
    lets say for example, when there is a character of having ASCII value more than 127, it will be stored as 2's compliment of the value in the normal arrays, and in signed storage it will appear as if a negative value whereas in unsigned storage it will be the other way round.

    so wanted to know whether the QByteArray has anything as such, b'coz it also stores only characters data!

    Thanks and Regards

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is the format of QByteArray's storage?

    Well, since it works only with "char" and not "unsigned char" it is safe to assume that it works with signed data.

  5. The following user says thank you to marcel for this useful post:

    LiCodeX (31st October 2007)

  6. #5
    Join Date
    Jul 2007
    Posts
    25
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: What is the format of QByteArray's storage?

    oh well I guessed the same but wanted to confirm with someone over here.
    and I'm bit wary about whether or not its really good to use QByteArray when handling a data which can be sign critical.

    Thanks and Regards

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.