HI,
Can we convert string to byte array in symbian c++ as we do lke java.Please help me if any body knows how to convert string into byte array?
HI,
Can we convert string to byte array in symbian c++ as we do lke java.Please help me if any body knows how to convert string into byte array?
TBuf8 etc. are actually byte arrays already, so you could use [x] where x is zero based index to access the byte stored in the descriptor.
Can we use that TBuf8 in double dimensional array as x[ ] [ ] .Please can u tel me how to use double dimensional byte array?Please
Never used it that way, thougn you could try using for example pointer array with HBufC8, or something like CDesC8ArrayFlat with TBuf8.
Not possible with TBuf8. You should use real two dimensional byte array, e.g. TUint8 byteArray[10][30]
If you absolutely need TBuf8 to store two dimensional array.,you should implement your own indexing logic (map two dimensional array index to one dimensional index to use with TBuf8).
Hai,
I am storing the values in HBufC8* requestdata;Now i want to test how we can display the requestdata ti byte array.
I am using following code for the.requestdata->Des().Append(_L8("10"));
requestdata->Des().Append(_L8("20112011"));
LOGTXT("VALUE OF REQUESTDATA");
LOGDES16(requestdata->Des());
LOGDES16(requestdata[0].Des());
LOGDES16(requestdata[1].Des());//here it crashes with user 23
LOGDES16(requestdata[2].Des());
LOGDES16(requestdata[3].Des());
LOGDES16(requestdata[1].Des());//here it crashes with user 23 here it is crashing
can u tel me y it is happening so?
Hi,
This is the error reason
23
This panic is raised when any operation that moves or copies data to an 8 bit variant descriptor, causes the length of that descriptor to exceed its maximum length.
It may be caused by any of the copying, appending or formatting member functions and, specifically, by the Insert(), Replace(), Fill(), Fillz() and ZeroTerminate() descriptor member functions. It can also be caused by the SetLength() function. See TDes8.
descriptor copying issue from 8 bit to 16bit.
Regards,
Mateen Maldar
"Whatever the mind can conceive and believe, the mind can achieve"
thia case it is not actually that, it is the misunderstanding the HBufC would somehow be array of descriptors.. So what about trying to use it as a array of chars instead..
The thing i need is HBufC8* requestdata; in which contents of requestdata->Des() has to be displayed in byte array as [].Please tel me how i can do this.I tried in many ways but dint get how to write in byte array.Please help me.
Misunderstanding of HBufC, pointers, arrays and 8/16-bit descriptors probably.
Prathi: generally you should review these topic once more, what does pointer->something and pointer[x].something mean, why 0 works and 1 does not, etc.
For your particular use case you may need (*pointer)[x], which is different from pointer[x]
However if LOGDES16 logs a 16-bit descriptor, you need a 16-bit descriptor. While L8 is a 8-bit one, so requestdata seems to be a 8-bit one. You can allocate a HBufC and copy the data into it, likeCode:HBufC *des16=HBufC::NewLC(requestdata->Length()); des16->Des().Copy(*requestdata); LOGDES16(*des16); CleanupStack::PopAndDestroy(); // des16