oadams
oadams

Reputation: 3087

Endianness and hexdump of text file

My computer has an x86-64 processor and runs linux.

I created a textfile called with the following characters: abcde (a new line would have been put at the end too)

I ran a hexdump on this file and got:

0000000 6261 6463 0a65                         
0000006

The order of the bytes suggests that the text was stored as badc\ne. Why is this? Is this related to endianness? Why is the order changed within two-byte blocks, but not overall? I could understand this if my computer had a 16 bit word length, but that is not the case.

Upvotes: 1

Views: 484

Answers (1)

user2100815
user2100815

Reputation:

Endianness does not affect byte order in files. What you are seeing is some artefact of your hexdump program.

Upvotes: 2

Related Questions