ctypes return char array with null chars

C

chris cannady

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
 
M

Mark Tolonen

chris cannady said:
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?
''

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

-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top