How do I convert between big-endian and little-endian values in C++?

前端 未结 30 2521
难免孤独
难免孤独 2020-11-21 23:18

How do I convert between big-endian and little-endian values in C++?

EDIT: For clarity, I have to translate binary data (double-precision floating point values and 3

30条回答
  •  北海茫月
    2020-11-21 23:57

    I am really surprised no one mentioned htobeXX and betohXX functions. They are defined in endian.h and are very similar to network functions htonXX.

提交回复
热议问题