Symbian
Symbian OS Library

FAQ-0814 Is there a way to get binary data in a _LIT?

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



 

Classification: C++ Category: Base
Created: 09/03/2002 Modified: 09/11/2002
Number: FAQ-0814
Platform: Not Applicable

Question:
Is there a way to get binary data in a _LIT?

Answer:
The _LIT macros just use the sizeof() operator to find the amount of data, so you can use the \xHHH escape sequences to put binary data into a _LIT.
You would need to worry about byte-ordering issues when using _LIT or _LIT16 (rather than _LIT8), since \x27 in a Unicode string actually means 0x0027, and on Symbian OS will be stored as 0x27 followed by 0x00 at the next address.

So, if you are prepared to write something like:


    _LIT(KBinaryStuff, "\x3412\x7856\xbc9a\xf0de");

    then you can get the sequence of bytes


      0x12 0x34 0x56 0x78 0x9a 0xbc 0xde 0xf0