Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
String Literals are consructed via the _LIT macro. The macro take two params:
- literal name
- pointer to the NULL-terminated string
_LIT( KMyLiteral, "My string literal" );
Literals are stored as TLitC objects - they are not actually descriptors themselves, but they can be converted to descriptors:
TInt len = KMyLiteral().Length()
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 !