C-Python and Endianness
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Mon Mar 27 05:34:38 EDT 2017
Op 26-03-17 om 08:47 schreef Ganesh Pal:
> Hello Team ,
>
>
>
>
> I want to write the hexadecimal string that is passed from python as it
> is on disk in C , my problem is that the values are getting stored in
> little endian and
Are you sure you are passing a string? Or are you passing a number and expecting
a particulare result when you hexdump the file?
> the values are swapped it has been quite a pain for me to fix this , any
> suggestion on how to fix this (I am on Python 2.7 and Linux).
Why is this a problem? This is how things usually work on little endians
machines. If you are just reading and writing numbers in a binary way
this will work without a problem. However you may need to be carefull
when transferring the file to a bigendian machine.
So why do you perceive this swapping as a problem to be fixed?
--
Antoon.
More information about the Python-list
mailing list