Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92837

Re: ctypes and byte order

From Terry Reedy <tjreedy@udel.edu>
Subject Re: ctypes and byte order
Date 2015-06-18 13:02 -0400
References <818768874.4716193.1434617881522.JavaMail.root@sequans.com> <1972345947.4721181.1434620395686.JavaMail.root@sequans.com>
Newsgroups comp.lang.python
Message-ID <mailman.604.1434647011.13271.python-list@python.org> (permalink)

Show all headers | View raw


On 6/18/2015 5:39 AM, Jean-Michel Pichavant wrote:

> I'm currently writing python code that writes a small binary file to
> be used by another device which code is written in C. The python code
> runs on a little endian CPU, and unfortunately, the other device is
> using a big endian MIPS.

The struct module is designed for this.  It reads and writes packed 
binary data of various types and sizes in either big or little endian 
order.  It should be easier than ctypes.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: ctypes and byte order Terry Reedy <tjreedy@udel.edu> - 2015-06-18 13:02 -0400

csiph-web