I am downloading a text string from a web service into an RBuf8 using this kind of code (it works..)
void CMyApp::BodyReceivedL( const TDesC8& data ) { int newLength = iTextBuffer.Length() + data.Length(); if (iTextBuffer.MaxLength() < newLength) { iTextBuffer.ReAllocL(newLength); } iTextBuffer.Append(data); }
I want to then convert the RBuf8 into a char* string I can display in a label or whatever.. or for the purposes of debug, display in
RDebug::Printf('downloading text %S', charstring);
edit for clarity..
My conversion function looks like this..
void CMyApp::DownloadCompleteL() { { RBuf16 buf; buf.CreateL(iTextBuffer.Length()); buf.Copy(iTextBuffer);
RDebug::Printf('downloaded text %S', buf); iTextBuffer.SetLength(0); iTextBuffer.ReAlloc(0); }
But this still causes a crash. I am using S60 3rd Edition FP2 v1.1
What you may need is something to the effect of:
This tutorial may help you.