×
Namespaces

Variants
Actions

Converting Descriptor to Char and Char to Descriptor

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: bharatuppal (11 Jul 2007)
Last edited: hamishwillee (20 Jul 2012)

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

This page was last modified on 20 July 2012, at 09:50.
58 page views in the last 30 days.
×