title: ctypes Fixed-size char Array in Structure Field and Initialization
body: <p>How do I initialize a fixed-size character array, such as <code>char a[32]</code>, field of a structure using <code>ctypes</code>? Example:</p>
  
  <pre><code>import ctypes
  
  class MyStructure(ctypes.Structure):
      _fields_ = [("a", ctypes.c_char * 32)]
  
  a = (ctypes.c_char * 32)(*b"Hi!")
  mystruct = MyStructure(a=a)
  </code></pre>
  
  <p>This gives me an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "...", line ..., in &lt;module&gt;
      mystruct = MyStructure(a=a)
  TypeError: expected bytes, c_char_Array_32 found
  </code></pre>
  
  <p>Additional info: this is a MWE of a C++ DLL that has a structure with fixed-size character arrays that act as strings (e.g., names of things).</p>