PDA

View Full Version : How to set values in QByteArray?



Gokulnathvc
19th July 2011, 07:20
How to set values in QByteArray? I want to assign 44 length to Bytearray.

I have used
QByteArray buf;
buf.resize(44);

I want those 44 bytes to be zero. how to assign this.

Santosh Reddy
19th July 2011, 07:25
After a call to resize(), newly allocated bytes have undefined values. To set all the bytes to a particular value, call QByteArray::fill()

Gokulnathvc
19th July 2011, 07:44
Thanks.. That works fine......