机器的字节顺序 [英] Endianness of machine

查看:61
本文介绍了机器的字节顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检查机器字节顺序的代码

Code to check endianness of machine

推荐答案

friend.05 schrieb:
friend.05 schrieb:
代码检查机器的字节顺序
Code to check endianness of machine




您忘了包含您的代码。

请确保它是
$ b的编译部分$ b代码并解释你确切的问题。


干杯

Michael

-

电子邮件:我的是/ at / gmx / dot / de地址。



You forgot to include your code.
Please make sure that it is a compiling piece of
code and explain your exact problem with it.

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.


#include< stdio.h>


int main()

{

long x = 0x34333231;

char * y =(char *)& x;


if(strncmp(y," 1234",4))

printf(" Big Endian");

否则

printf(" little Endian");

}

#include <stdio.h>

int main()
{
long x = 0x34333231;
char *y = (char *) &x;

if(strncmp(y,"1234",4))
printf("Big Endian");
else
printf("little Endian");
}





friend.05写道:


friend.05 wrote:
检查机器字节顺序的代码
Code to check endianness of machine



它在C-FAQ中


检查Q 20.9
http://www.eskimo.com/~scs/C-faq/top.html


- Ravi


Its in C-FAQ

Check Q 20.9 at
http://www.eskimo.com/~scs/C-faq/top.html

- Ravi


这篇关于机器的字节顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆