Controlling buffer alignment in file.read()
Laurent Pointal
laurent.pointal at free.fr
Sat Mar 22 14:28:35 EDT 2014
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 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.
>
> Thanks,
> - Mitko
Did you try to set buffering parameter to 0 (unbuffered) ?
Eventually going to os.open() which map tp low level (eventually followed by
an os.fdopen())
http://docs.python.org/2/library/os.html#os.open
A+
Laurent.
More information about the Python-list
mailing list