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


Groups > comp.lang.python > #68516

Controlling buffer alignment in file.read()

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <mitko.haralanov@intel.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'alignment': 0.07; 'binary': 0.07; 'method.': 0.07; 'subject:()': 0.09; 'python': 0.11; 'aligned.': 0.16; 'allocates': 0.16; 'arbitrary.': 0.16; 'file.read()': 0.16; 'multiples': 0.16; 'thanks,': 0.17; 'all,': 0.19; 'to:name:python-list@python.org': 0.22; 'function': 0.29; 'aligned': 0.31; "user's": 0.31; 'file': 0.32; 'received:169.254': 0.32; 'device': 0.34; 'there': 0.35; 'method': 0.36; 'charset:us- ascii': 0.36; 'received:169': 0.37; 'received:10': 0.37; 'to:addr :python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'therefore,': 0.64; 'covers': 0.68
X-ExtLoop1 1
X-IronPort-AV E=Sophos;i="4.97,680,1389772800"; d="scan'208";a="501464236"
From "Haralanov, Mitko" <mitko.haralanov@intel.com>
To "python-list@python.org" <python-list@python.org>
Subject Controlling buffer alignment in file.read()
Thread-Topic Controlling buffer alignment in file.read()
Thread-Index Ac9C5+Y0EIEp9ebFTROzTNrUEcEfyw==
Date Tue, 18 Mar 2014 20:23:19 +0000
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.1.200.107]
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.8260.1395174272.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395174272 news.xs4all.nl 2845 [2001:888:2000:d::a6]:36105
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68516

Show key headers only | View raw


Hi all,

I am using Python to read from a binary device file which requires that all read sizes are in 8byte multiples and the user's buffer is 8byte aligned.

I am currently using a file object and the file.read() method. However, the issue is that the file.read() method allocates the buffer passed to C function under the covers and, therefore, the alignment is arbitrary.

Is there a way that I can get file.read() to use an 8byte aligned buffer?

Thanks,
- Mitko

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


Thread

Controlling buffer alignment in file.read() "Haralanov, Mitko" <mitko.haralanov@intel.com> - 2014-03-18 20:23 +0000
  Re: Controlling buffer alignment in file.read() Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-19 12:08 +1300
    RE: Controlling buffer alignment in file.read() "Haralanov, Mitko" <mitko.haralanov@intel.com> - 2014-03-18 23:13 +0000
      Re: Controlling buffer alignment in file.read() Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-19 13:07 +1300
      RE: Controlling buffer alignment in file.read() Laurent Pointal <laurent.pointal@free.fr> - 2014-03-22 19:28 +0100

csiph-web