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

Symbian – TBuf/TBufC to TPtrC conversions

To Create a TPtrC from TBuf/TBufC is straight forward and can be achieved in two ways,

  • Using the constructor
  • Using the Set Method

Here you go,

LIT(KText , "Testing");
TBufC<10> Buffer( KText );

// Creation of TPtr using Constructor
TPtrC     Ptr (buffer);

// Creation of TPtr using Member Function
TPtrC     Ptr1;

The variable buffer can be of either TBuf or TBufC

To convert a TPtrC to TBufC is pretty simple

TBufC<16> bufferC = Ptr1.Des() // Ptr1 is the TPtrC declared above

Once the we have the TBufC we can convert it to TBuf as mentioned in one of my posts



No comments yet.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: