How can I write data from unsigned char* buffer to QDatastream. Threre are methods writeBytes and writeRawData. But they accept const char*. Can I use unsigned char* for it?
You can just cast to const char*
unsigned char array[] = {1,2,3,4,5};
QByteArray ba;
QDataStream datastream(&ba,QIODevice::ReadWrite);
datastream.writeRawData((const char*) array,5);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With