打印

characters to long

[复制链接]
1420|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ChanTaiMan|  楼主 | 2009-12-7 11:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 ChanTaiMan 于 2009-12-7 14:06 编辑

I am having a group of characters to change to long

0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07;

And I am expecting the result is:-

0x03020100, 0x04030201, 0x05040302, 0x06050403, 0x07060504.

And here is my program:-

unsigned char MyChar[8] =
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
unsigned long *pLong;

pLong =(unsigned long *) &Mychar[0];
printf(“My Long; %08X”, *pLong);
And I got:
0x00000000

pLong = (unsigned long *)&Mychar[1];
printf(“My Long; %08X”, *pLong);
0x00000001

So on....


I am using Keil C for ARM 3.0

Any suggestion?
Jacky

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

23

主题

34

帖子

0

粉丝