"chris cannady" <booo...@gmail.com> wrote in message news:b103e85a-05d5-4195-a18f-bd143e9f5...@b33g2000yqc.googlegroups.com...
Hi all,

I am passing a ctypes struct byref to a dll. When I get the struct
back, it looks like the char array in the struct was truncated at the
first null char. It should be 192 bytes long, but I know the 3rd
through 6th byte are null chars and the array was truncated right
before byte 3.

Is there any way to get the full array back including null chars?

Thanks

It could depend on how your struct is declared.  Maybe this demo will help?

   >>> x=(c_char*10)()
   >>> x
   <__main__.c_char_Array_10 object at 0x00A049E0>
   >>> x.raw
   '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
   >>> x.value
   ''

'value' prints it is a string, stopping at the first null. 'raw' dumps the whole array.

-Mark


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to