Posts Tagged stupid

No Way…

I think I actually got a snippet of Symbian code to work on the first attempt! This is a first… Maybe I’m actually getting the hang of this. I just find the whole “descriptor” concept very odd.

Anyway, all I was trying to do was replace all plus signs with spaces. I normally wrestle with descriptor nonsense for a while but this time, I got it on the first try!

_LIT(TestData, "THIS+IS+A+TEST");
HBufC* heapBuf = HBufC::NewLC(255);
*heapBuf = TestData;
TPtr pHeapBuf(heapBuf->Des());
while (heapBuf->Find(_L("+")) > 0)
{
pHeapBuf.Replace(heapBuf->Find(_L("+")), 1, _L(" "));
}
 
CleanupStack::PopAndDestroy(heapBuf); //Don't forget!

Bleh… stupid Symbian. Thank goodness I didn’t have to change the length of the descriptor…

, ,

No Comments