When does Endianness become a factor?

前端 未结 8 1933
天涯浪人
天涯浪人 2020-12-12 14:52

Endianness from what I understand, is when the bytes that compose a multibyte word differ in their order, at least in the most typical case. So that an 16-bit integer may b

8条回答
  •  醉梦人生
    2020-12-12 15:29

    For the record, if you're transferring data between devices you should pretty much always use network-byte-ordering with ntohl, htonl, ntohs, htons. It'll convert to the network byte order standard for Endianness regardless of what your system and the destination system use. Of course, both systems shoud be programmed like this - but they usually are in networking scenarios.

提交回复
热议问题