[docs] [issue12476] ctypes: need example how to pass raw data from Python
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>
More information about the docs