开发者

How to convert 'char' or ''TBuf' to 'TPtrC8'?

开发者 https://www.devze.com 2023-01-11 14:07 出处:网络
I\'ve a question concerning a conversion from char to TPtrC8 on Symbian. How can I transform a char to TPtrC8 or a TBu开发者_StackOverflowf to TPtrC8? Is there a simple and quick way to do that?The TP

I've a question concerning a conversion from char to TPtrC8 on Symbian. How can I transform a char to TPtrC8 or a TBu开发者_StackOverflowf to TPtrC8? Is there a simple and quick way to do that?


The TPtrC8 has constructors that take char* and TDes8 as arguements. This effectively wraps the TPtrC8 around the the character array in the char* or the TBuf8

TBuf is a 16 bit construct and you will have to convert it to a TBuf8 before you can use it with a TPtrC8. If you are using a single character literal, you also might have to put it into a TBuf8. TDes8::Copy is your friend.


Thanks and done by the following code:

  • TBuf<25> iIMSI; TPtrC iPtrC(iIMSI);
  • TPtrC8 iPtrC8((TUint8*)iPtrC.Ptr(), iPtrC.Length()*2);
0

精彩评论

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