开发者

How to convert from BYTE* to QString?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜