Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert unsigned char array to QByteArray in Qt?

Tags:

qt

unsigned char x[] = {0x7E,0x00,0x00,0x0F };

I want to push it to QByteArray but the QByteArray when finds '\0' stops copying.

like image 446
Ashish Avatar asked May 06 '11 13:05

Ashish


1 Answers

Which Qt version are you using? 4.7 has QByteArray(const char*, size) which should work and QByteArray::fromRawData(const char*, int size) which also should work.

like image 176
RedX Avatar answered Nov 02 '22 21:11

RedX