how to convert TBuf8 to TDesC

Login to reply to this topic.
Tue, 2005-02-01 08:33
Joined: 2005-01-19
Forum posts: 46
hi there,
i m begginer in symbian,

i m trying to read the file & display the contents into a edwin control
but the problem is file contents r return in TBuf8 format & the edwin accept text in TDesC fromat

i tried  but i m not able to do that

can anyone help

RaHuL

Tue, 2005-02-01 08:47
Joined: 2005-01-31
Forum posts: 122
how to convert TBuf8 to TDesC
I am not very sure about this but I think there is Copy function in TDesC or TDes which takes a TDes8 as parameter. That should do it.
Tue, 2005-02-01 11:10
Joined: 2004-07-28
Forum posts: 1379
how to convert TBuf8 to TDesC
There is an artical on new LC on the numerious ways to convert 8 to 16 bit descriptors.  Goes something like this:

TBuf8<10> buf8 = ...;

TBuf<10> buf16;
buf16.Copy(buf8);

Thats one way - only if you know at build time the lengh of the string.  The other way being to use a HBufC:


TBuf8<10> buf8 = ...;

HBufC* buf16 = HBufC::NewLC(buf8.Length());
buf16->Des().Copy(buf8);
CleanupStack::PopAndDestory(buf16);

didster

  • Login to reply to this topic.