How can i convert from any descriptor eg., Tbufc,tbufc16,Hbufc8/16 to TDesc8?

Login to reply to this topic.
Mon, 2008-06-23 14:30
Joined: 2008-06-04
Forum posts: 5

HI all, I want to convert the file path to TDesc8.How can i do it? For eg., I have done like this ,

I have something like const TDesC8& aBuffer

_LIT(Kbufferpath,"c:\\Media Files\\audio\\music\\goodbye");
TBufC16<256> buffer(Kbufferpath);
aBuffer =buffer;
Not working.My aim is that filepath i need to give to TDesc8 descriptor.

How to do it.Please suggests me.

-Vite


Mon, 2008-06-23 16:03
Joined: 2007-09-24
Forum posts: 80
Re: How can i convert from any descriptor

Hi
This thread have been discussed here many time , first you should have searched this question
Anyway
aBuffer =buffer;
TBufC16 and TDesc8 are classes ,you can't act on these like data type and another thing you can only use "=" only with same class object , if the
object class has operator overloading function for "="
Now come to solution
_LIT(Kbufferpath,"c:\\Media Files\\audio\\music\\goodbye");
TBuf8<100> filepathbuf8;
CnvUtfConverter::ConvertFromUnicodeToUtf8( filepathbuf8, Kbufferpath);



Tue, 2008-06-24 06:35
Joined: 2008-06-04
Forum posts: 5
Re: How can i convert from any descriptor eg., to TDesc8?

HI Praveen,

Thanks for the fast response.
I got the point what u r saying >But i have 1 function which has the argument of Const TDesC8.I need to pass a descriptor of this.ie.,
I need to convert from any descriptor to this TDesC8
void abc(Const TDesC8& aBuffer);
The filepath i need to give to TDesc8 aBuffer descriptor
How to do it?

Vite

Tue, 2008-06-24 07:07
Joined: 2007-09-24
Forum posts: 80
Re: How can i convert from any descriptor

These are the class declaration for Symbian 8- bit descripter

class TBuf8 : public TBufBase8;
class TBufBase8 : public TDesC8 , public TDes8;
class TDes8 : public TDesC8;

Then dude , you do'nt need to convert from TBuf8 to TDesC8 OR TDes8 to TDesC8 , It is the super class for both ,Now
void abc(Const TDesC8& aBuffer);
you call this function with TBuf8 object o
TBuf8<100> buf8 ;
abc(buf8 );
try it ,if still problem post your code and error here
Thanks and regard
Praveen Kumar Sharma

Tue, 2008-06-24 07:30
Forum Nokia Champion
Joined: 2006-10-12
Forum posts: 463
Re: How can i convert from any descriptor eg., Tbufc,tbufc16,Hbu

Hi vite,

http://descriptors.blogspot.com/

That contains all the info you are seeking and will make things easier for you

Good Luck

  • Login to reply to this topic.