RBuf8 to char* in Symbian C++

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)

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);

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:

RDebug::Print( _L( "downloaded text %S" ), &buf );

This tutorial may help you.

void RBuf16::Copy(const TDesC8&) will take an 8bit descriptor and convert it into a 16bit descriptor.

You should be able to display any 16bit descriptor on the screen. If it doesn't seem to work, post the specific API you're using.

When an API can be used with an undefined number of parameters (like void RDebug::Printf(const char*, ...) ), %S is used for "pointer to 16bit descriptor". Note the uppercase %S.

Need Your Help

Somthing wrong with using CSV as database for a webapp?

python csv web-applications flask

I am using Flask to make a small webapp to manage a group project, in this website I need to manage attendances, and also meetings reports. I don't have the time to get into SQLAlchemy, so I need t...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.