I need to access the contents of a char* by casting it to an array
Here's a demo:
from ctypes import *
foo = (c_char * 4)()
foo.value = "foo"
print foo.raw # => 'foo\x00'
foo_ptr = cast(foo, c_char_p)
print foo_ptr.value # => 'foo'
Now I want to convert foo_ptr back into a (c_char * 4). Neither of these work
foo_ = (c_char * 4)(foo_ptr)
foo_ = cast(foo_ptr, c_char * 4)