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?
no, a pointer is just a memory address. the command above will copy the 5 bytes verbatim from that memory address. You need to be careful when you read those bytes out of the buffer that you cast the pointer back to an unsigned char.