Saving/assigning TPtrC to TPtrC

Login to reply to this topic.
Thu, 2006-01-05 02:39
Joined: 2005-12-07
Forum posts: 35
Can someone help me with this.. i want to assign/save a value, from one TPtrC to another TPtrC. Anyone has the method to do that??

TPtrC Command1 = aLex.NextToken();
         
TPtrC Variable = aLex.NextToken();
            
TPtrC Parameter1 = aLex.NextToken();

I need a method to save/assign my Parameter1's value to Variable's value..

Value of Parameter1 will be an integer.
Value of Variable will be a string.

Thanks in advance

Thu, 2006-01-05 07:16
Joined: 2005-07-13
Forum posts: 75
Re: Saving/assigning TPtrC to TPtrC
give this a whirl, takes a TPtrC16 and returns a string....

LPTSTR DesCToWcs(TPtrC16 szIn) {

   int length = szIn.Length();

   LPTSTR szRet = (LPTSTR) malloc((length+1) * sizeof(unsigned short));

   int i;

   for(i = 0; i < length; i++) {
      szRet[i] = szIn[i];
   }

   szRet[i] = 0;

   return szRet;
}

"beer is proof that god loves us, and wants us to be happy!"

Thu, 2006-01-05 08:30
Joined: 2005-12-07
Forum posts: 35
Re: Saving/assigning TPtrC to TPtrC
I'm sorry morri but your code didnt work.
As i'm new to symbian OS C++. Can you please modify your codes so that i can use it directly without editing???

thanks a thousand's million. Grin
Fri, 2006-01-06 00:52
Joined: 2005-07-13
Forum posts: 75
Re: Saving/assigning TPtrC to TPtrC
it should work- ive used it a few times in my progs.....just fiddle with it a bit

"beer is proof that god loves us, and wants us to be happy!"

  • Login to reply to this topic.