Namespaces
Variants
Actions

Converting Descriptor to Char and Char to Descriptor

Jump to: navigation, search

Converting Descriptor to Char*

TBuf8 <200> fromBuf;
 
char* toChar;
  • First Way
Mem::Copy((char*)toChar,fromBuf.Ptr(),fromBuf.Length() );
  • Second way
tochar = NULL;
tochar = (char *) malloc(fromBuf.Length()+1);
TInt index = 0;
for(index =0 ; index < fromBuf.Length(); index++)
{
toChar[index] = fromBuf[index];
}
toChar[index] = 0; //toChar contains the content

Converting Char* to Descriptor

TBuf8<200> toBuffer;
char* fromChar;
  • First Way
TPtrC8 tempPtr8((TUint8 *)(fromChar));
HBufC* toBuffer = HBufC::NewLC(tempPtr8.Length());
toBuffer->Des().Copy(tempPtr8); // toBuffer contains the content
  • Second way
toBuffer.Copy(fromChar);

Note :- here basic conversion between Char and Buffer is given for conversion between different descriptors in symbian refer to this link

Conversion between Descriptors

Comments

(no comments yet)

This page was last modified on 26 May 2011, at 11:48.
52 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2012 All rights reserved