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


Groups > comp.lang.python > #68524

Re: Controlling buffer alignment in file.read()

From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: Controlling buffer alignment in file.read()
Date 2014-03-19 12:08 +1300
Message-ID <bos1vgF8r6oU1@mid.individual.net> (permalink)
References <mailman.8260.1395174272.18130.python-list@python.org>

Show all headers | View raw


Haralanov, Mitko wrote:
> 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.
> 
> Is there a way that I can get file.read() to use an 8byte aligned buffer?

For control at that level you'd be better off using
direct system calls, i.e. os.open() and os.read(),
then you can read exacty the number of bytes you want.

-- 
Greg

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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