HBufC8 to TBuf8

Login to reply to this topic.
Tue, 2006-05-16 08:42
Joined: 2005-12-16
Forum posts: 25
Hi All,

Plz sgggest me how to convert

HBufC8 into TBuf8..........
   
Thanks in advence....

Sanjeev mavai

Tue, 2006-05-16 08:47
Joined: 2006-04-05
Forum posts: 104
Re: HBufC8 to TBuf8
Hi,

TPtr8 HBufC8::Des()

This will get you back a pointer that you can either use directly or use to copy the contents into a TBuf8.

PL
Tue, 2006-05-16 10:09
Joined: 2005-03-30
Forum posts: 206
Re: HBufC8 to TBuf8
or if u need an unmodifiable pointer the use this:
HBufC* aBuffer;

*aBuffer;

Note the pointer u are receiving is a constant pointer.. u should use this cause it's faster :d in processor cycles...

cheers

guda

Thu, 2006-05-25 11:17
Joined: 2006-01-09
Forum posts: 105
Re: HBufC8 to TBuf8
Hi Smiley

Use this code snippet in order to convert from HBufC8 to TBuf8 :

//code starts here

_LIT8(KTitle1,"Information");
HBufC8* heapdes = KTitle1().AllocLC();
TPtr8 tptr = heapdes->Des();
TBuf8<13> tbuf;
tbuf.Copy(tptr);//tbuf's will now contain what heapdes has i.e. "Information"
CleanupStack::PopAndDestroy(heapdes);
//code ends here

Best Regards
CodePupil

Thanks and Regards
CodePupil
__________________________
You are I and I am he .. !!

  • Login to reply to this topic.