Results 1 to 3 of 3

Thread: How to set values in QByteArray?

  1. #1
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default How to set values in QByteArray?

    How to set values in QByteArray? I want to assign 44 length to Bytearray.

    I have used
    Qt Code:
    1. buf.resize(44);
    To copy to clipboard, switch view to plain text mode 
    I want those 44 bytes to be zero. how to assign this.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to set values in QByteArray?

    After a call to resize(), newly allocated bytes have undefined values. To set all the bytes to a particular value, call QByteArray::fill()

  3. The following user says thank you to Santosh Reddy for this useful post:

    Gokulnathvc (19th July 2011)

  4. #3
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to set values in QByteArray?

    Thanks.. That works fine......

Similar Threads

  1. Replies: 1
    Last Post: 22nd June 2011, 08:12
  2. Extracting int values from QByteArray
    By Tottish in forum Newbie
    Replies: 4
    Last Post: 7th April 2010, 10:41
  3. Replies: 9
    Last Post: 25th July 2009, 13:27
  4. QByteArray
    By gyre in forum Newbie
    Replies: 4
    Last Post: 9th October 2007, 18:30
  5. QByteArray in Qt3
    By joseph in forum Qt Programming
    Replies: 1
    Last Post: 6th September 2007, 06:16

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.