To find what you seek in the road of life,

the best proverb of all is that which says:

"Leave no stone unturned."

Edward Bulwer Lytton

How to get binary data in a _LIT?

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

0 comments: