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


Groups > comp.lang.python > #68516

Controlling buffer alignment in file.read()

From "Haralanov, Mitko" <mitko.haralanov@intel.com>
Subject Controlling buffer alignment in file.read()
Date 2014-03-18 20:23 +0000
Newsgroups comp.lang.python
Message-ID <mailman.8260.1395174272.18130.python-list@python.org> (permalink)

Show all headers | 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