Problem of converting between TPtrC and TBuf,Could anybody help me?
Login to reply to this topic.
Wed, 2007-11-28 16:33
Joined: 2007-09-15
Forum posts: 26

Could anybody tell me how to covert TPtrC to TBuf?

One function return a TPtrC, I want to combine aTBuf and the TPtrC(In other words,How to append the TPtrC to a TBuf)?

It's urgent,Pls help me! Thanks in advance.


Thu, 2007-11-29 00:11
Joined: 2007-09-23
Forum posts: 182


Why don't you look at the public API for TBuf, and the classes it inherits from. You've said you want to append, well, lo and behold, there are some functions called TDes::Append().

There's three of them,

will Append(TChar aChar) work? no we don't have a TChar.
will Append(const TUint *aBuf,TInt aLength) work? No as we have a TPtrC?
Will Append(const TDesC &aDes) work? Yes, TPtrC inherits from TDesC.

Thu, 2007-11-29 15:41
Joined: 2007-09-15
Forum posts: 26

Thank you Numpty Alert for your reply.

Thu, 2007-11-29 16:24
Joined: 2007-11-09
Forum posts: 3

hey another suggestion this could work too using the
Dec() function you could be able to modify the non modifiable descriptors


_LIT(KTxtHW,"Hello World!"); 

TPtrC<20> buf(KTxtHW);  //

TPtr ptr2(buf.Des());


copyright 2003-2009 NewLC SARL