Converting Descriptor to Char and Char to Descriptor
Article Metadata
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


(no comments yet)