Symbian
Symbian OS Library

FAQ-1202 What formatting character do I use to create a string containing large numbers ?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Development
Created: 01/06/2005 Modified: 01/17/2005
Number: FAQ-1202
Platform: Not Applicable

Question:
Could anyone tell me which formatting character to use when creating strings containing large numbers. %d only works for TUint32 or smaller.

For example:
TInt64 totalSize = TotalMemSize();
HBufC* descriptionTxt = HBufC::NewLC(35 + unitTxt->Length());
descriptionTxt->Des().AppendFormat(_L("Total size is %d %S"), (TUint32)totalSize, unitTxt);

If totalSize is not cast to a TUint32 then this will raise a USER 13 panic.


Answer:
You need to use the L prefix on the formatting character.

    For example %Lu or %Ld can be used for unsigned or signed large integers respectively.
    This is not documented in the Developer Library.