Any way to read big endian data with little endian program?

前端 未结 8 1828
走了就别回头了
走了就别回头了 2021-01-13 13:50

An external group provides me with a file written on a Big Endian machine, and they also provide a C++ parser for the file format.

I only can run the parser on a lit

8条回答
  •  庸人自扰
    2021-01-13 14:29

    the best approach is to just define the endianess in the file format, and not say it's machine dependent. the writer will have to write the bytes in the correct order regardless of the CPU it's running on, and the reader will have to do the same.

提交回复
热议问题