RE: Controlling buffer alignment in file.read()

2014-03-22 Thread Laurent Pointal
Haralanov, Mitko wrote: 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. The problem is not controlling the number of bytes read. That part seems to be working. The issue is that

Controlling buffer alignment in file.read()

2014-03-18 Thread Haralanov, Mitko
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

Re: Controlling buffer alignment in file.read()

2014-03-18 Thread Gregory Ewing
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

RE: Controlling buffer alignment in file.read()

2014-03-18 Thread Haralanov, Mitko
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. The problem is not controlling the number of bytes read. That part seems to be working. The issue is that the buffer into which the

Re: Controlling buffer alignment in file.read()

2014-03-18 Thread Gregory Ewing
Haralanov, Mitko wrote: The problem is not controlling the number of bytes read. That part seems to be working. The issue is that the buffer into which the data is placed needs to be of certain alignment (8byte-aligned). Python does not seem to have a way that allows me to control that. Hmmm,

Re: Controlling buffer alignment in file.read()

2014-03-18 Thread Dan Stromberg
On Tue, Mar 18, 2014 at 1:23 PM, Haralanov, Mitko mitko.harala...@intel.com wrote: 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