From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Created: Den123 (28 Jun 2007)
Last edited: hamishwillee (25 Jul 2012)

String Literals are consructed via the _LIT macro. The macro take two params:

  • literal name
  • pointer to the NULL-terminated string

Simple example:

_LIT( KMyLiteral, "My string literal" );

Literals are stored as TLitC objects - they are not actually descriptors themselves, but they can be converted to descriptors:

// operator()
TInt len = KMyLiteral().Length()
// operator&
const TDesC& ptr = &KMyLiteral;
// implicitly operator const TDesC16&() const
void YouFunc( const TDesC& aParam )
YouFunc( KMyLiteral );

Some old examples in SDK can contain macro _L for literals constructing. Now this macro is deprecated. Always create literals using _LIT !

This page was last modified on 25 July 2012, at 23:01.
29 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.