I am trying to parse the FAT filesystem & I notice that many of the fields are more than 2 bytes. I was reading someone's program and he has defined unsigned short for a given field of 2 bytes. Now, my question is how does the compiler handle endianness? If I convert the short into hex by using 02x, the data is handled properly. The file is opened in binary mode & I wonder how data more than a byte can be interpreted i.e. how does the compiler know which byte is the LSB/MSB? The same goes for long and int.
anumash
0
Newbie Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.