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


Groups > comp.lang.python > #92837

Re: ctypes and byte order

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'binary': 0.05; 'endian': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:ctypes': 0.09; 'python': 0.11; 'jan': 0.11; 'ctypes.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.16; 'runs': 0.18; 'struct': 0.22; 'am,': 0.23; 'module': 0.23; 'header:In-Reply-To:1': 0.24; 'written': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'order.': 0.27; 'this.': 0.28; 'device': 0.29; "i'm": 0.29; 'terry': 0.29; 'writes': 0.31; 'code': 0.31; 'another': 0.34; 'file': 0.34; 'to:addr:python-list': 0.35; 'should': 0.37; 'subject:: ': 0.37; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'data': 0.40; 'skip:u 10': 0.62; 'cpu,': 0.84; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: ctypes and byte order
Date Thu, 18 Jun 2015 13:02:16 -0400
References <818768874.4716193.1434617881522.JavaMail.root@sequans.com> <1972345947.4721181.1434620395686.JavaMail.root@sequans.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-98-114-97-173.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <1972345947.4721181.1434620395686.JavaMail.root@sequans.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.604.1434647011.13271.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1434647011 news.xs4all.nl 2868 [2001:888:2000:d::a6]:45101
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92837

Show key headers only | 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