views:

89

answers:

2

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

A: 

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.

doron
A: 

Thanks and done by the following code:

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