[issue12476] ctypes: need example how to pass raw data from Python

anatoly techtonik report at bugs.python.org
Sun Jul 3 14:24:44 CEST 2011


anatoly techtonik <techtonik at gmail.com> added the comment:

ISTM that this code works ok.


data = open('data.raw', 'rb').read()
ret = checkBuffer(data, len(data))


You need to make sure that checkBuffer doesn't try to modify memory though. For mutable memory blocks use create_string_buffer().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12476>
_______________________________________


More information about the Python-bugs-list mailing list