How to write partial of a buffer which was returned from a C function to a file?

Chris Angelico rosuav at gmail.com
Thu Apr 12 01:31:17 EDT 2018


On Thu, Apr 12, 2018 at 2:16 PM,  <jfong at ms4.hinet.net> wrote:
> This C function returns a buffer which I declared it as a ctypes.c_char_p. The buffer has size 0x10000 bytes long and the valid data may vary from a few bytes to the whole size.
>
> In every call I know how much the valid data size is, but I suppose I can't use slice to get it because there may be zero byte in it. What to do?
>

You suppose? Or have you tested it?

ChrisA



More information about the Python-list mailing list