如何找出文件的字节序? [英] How to find out endianness of a file?

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

问题描述

如何确定它是大端文件还是小端文件?我只是试图用matlab编写一个big-endian文件,但可能没有用.现在,我想了解是否有可能了解它的类型.有什么建议吗?

How can I figure out whether it's a big-endian or little-endian file? I just tried to write a big-endian file with matlab but probably it didn't work. Now I want to learn if it is possible to learn what type it is. Any suggestion?

推荐答案

使用 FOPEN :

fileID = fopen(fileName)
[filename, permission, machineformat] = fopen(fileID)

第三个输出machineformat告诉您是大字节序('b')还是小字节序('l').

The third output, machineformat, tells you whether it's big endian ('b') or little endian ('l').

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

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