TUint32 to TBuf8
| Sat, 2005-05-21 05:52 | |
|
How can I convert a TUint32 number to TBuf8<4>?
So if I have: TUint32 num(0xaabbccdd) it should convert to: TBuf8<4> buf; buf(0) = 'dd' buf(1) = 'cc' buf(2) = 'bb' buf(3) = 'aa' Using "buf.Format(_L8("%x"), num)" gets me 8 8-bytes.. so I get buf(0) = 'd', buf(1) = 'd', buf(2) = 'c', ..., buf(7) = 'a'. But that's not what I want. |
|






Forum posts: 192
so if you want to keep `dd` you need 2 bytes
Forum posts: 205
for ex.:
TUint32 * myIntBuf[bufsize]
// Fill your myIntBuf
//
TPtr8 myIntDes( (TUint8 *) myIntBuf, bufsize*4,bufsize*4);
Best regards,
Michal Laskowski
Forum posts: 85
TPtr8 ptr(reinterpret_cast<TUint8*>(&myIntBuf), sizeof(myIntBuf), sizeof(myIntBuf));
TBuf8<4> buf;
buf.Append(ptr);