简体   繁体   English

如果在输出流的实例上调用write(0x01234567),则将什么写入流的目标?

[英]If write(0x01234567) is called on an instance of output stream, what will be written to the destination of the stream?

Hi,I have a question 嗨,我有一个问题

If write(0x01234567) is called on an instance of output stream, what will be written to the destination of the stream? 如果在输出流的实例上调用write(0x01234567),则将什么写入流的目标?

a. 一种。 The bytes 0x01, 0x23, 0x34, 0x45, and 0x67, in that order. 字节0x01、0x23、0x34、0x45和0x67依次排列。

b. The bytes 0x67, 0x45, 0x34, 0x23, and 0x01, in that order. 字节0x67、0x45、0x34、0x23和0x01按此顺序。

c. C。 The byte 0x01. 字节0x01。

d. d。 The byte 0x67. 字节0x67。

e. None of the above. 以上都不是。

I am getting "D" but answer "C"?, why? 我得到“ D”但回答“ C”吗?为什么? please explain 请解释

The output can vary depends on machine, support byte ordering big endian or little endian. 输出可以根据机器而异,支持字节顺序的大端或小端。 I think you ran the program on the machine that support little endian byte ordering that's why you getting 67. 我认为您在支持小尾数字节排序的机器上运行了程序,这就是为什么您要获得67。

Learn More: https://www.geeksforgeeks.org/little-and-big-endian-mystery/ 了解更多信息: https : //www.geeksforgeeks.org/little-and-big-endian-mystery/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM