×
Namespaces

Variants
Actions

Convert Descriptor to number & vice versa

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: kamaljaiswal (13 Nov 2007)
Last edited: hamishwillee (20 Jul 2012)
Reviewer Approved    Thumbs up icon sm.jpg

Convert Descriptor to Number

_LIT(KNum, "12345");
TLex lex(KNum);
TInt value = 0;
//lex.Val() gives KErrOverflow if converted value is greater than limit.
User::LeaveIfError(lex.Val(value));

Convert Number to Descriptor

TInt num(-6);
TBuf<8> des;
//take care of number of digits. if it exceed defined in TBuf<>, 8 here, it gives panic.
des.Num(num);
This page was last modified on 20 July 2012, at 12:48.
48 page views in the last 30 days.
×