If you have the option, use standard library functions to do byte-swapping operations, and standardize on the order in which bytes are stored in your data files; network byte order is the best.
如果可以选择的话,请使用标准库函数来进行字节交换操作,并按照字节在数据文件中存储的顺序进行标准化;网络字节顺序最适合这种工作。
Converts a value from host byte order to network byte order.
将值由主机字节顺序转换为网络字节顺序。
Converts a number from network byte order to host byte order.
将长值由网络字节顺序转换为主机字节顺序。
应用推荐