//
you're reading...
C++, Source Code, Symbian

Symbian – TBuf to char*

One common problem that we face while developing for Symbian devices is the conversion of TBuf to char*.
Here is how we do it,

TBuf<128> buffer;
//assign the buffer with the content that needs to be converted
char* str = new (ELeave) char[buffer.Length()];
CleanupStack::PushL(str);
for(int i=0; i
str[i] = buffer[i];
str[i]='';
CleanupStack::Pop(1);

now str contains the buffers contents.

Advertisements

Discussion

One thought on “Symbian – TBuf to char*

  1. Hi im a newbee for symbian, can u plz explain me in detail how to convert TBuf to char..

    thanks for any reply

    Posted by kathir | June 2, 2010, 2:33 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: