开发者

How to convert from BYTE* to QString?

开发者 https://www.devze.com 2023-01-15 16:59 出处:网络
I have a D开发者_开发问答ATA_BLOB structure but I need to convert it to QString. How can I do this?You can use the QString constructor with a QByteArray parameter.

I have a D开发者_开发问答ATA_BLOB structure but I need to convert it to QString. How can I do this?


You can use the QString constructor with a QByteArray parameter. You can use too the constructor with the const char* parameter too

Hope that helps


BYTE* myByteBlob; 
int myByteBlobSize;

// Get the blob, find out the size.
// ...

QString myString( QByteArray( myByteBlob, myByteBlobSize));


   BYTE* pu8_RawData = (BYTE*)i_RawData.parray->pvData;
   DWORD u32_RawLen  =        i_RawData.parray->rgsabound[0].cElements;

   qDebug() << QString(QByteArray((const char*) pu8_RawData, (int)u32_RawLen));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号