[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: C-Python and Endianness
From:       Antoon Pardon <antoon.pardon () rece ! vub ! ac ! be>
Date:       2017-03-27 9:34:38
Message-ID: 28bfac08-37fc-cb1f-bfa4-0fa033f162c2 () rece ! vub ! ac ! be
[Download RAW message or body]

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.

-- 
https://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic