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