title: How to use memcpy in Cython
body: <pre><code>with open(fname, 'rb') as fp:
      line = fp.readline().strip()
      content = fp.read()
  cdef int nb = len(content)
  #print("Hello ", nb)
  cdef char* c_string = &lt;char *&gt; malloc((nb + 1) * sizeof(char))
  cdef char* tmp_str = &lt;char *&gt; malloc(4)
  memcpy(tmp_str, c_string + 8, 4)
  print(atof(tmp_str))    # this line is ok
  for i in range(nb):
      memcpy(tmp_str, c_string + i, 4)  # error occur
      # print(atof(tmp_str))
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>    for i in range(nb):
      memcpy(tmp_str, c_string + i, 4)`
                              ^       `
  decodex.pyx:23:33: Cannot convert Python object to 'const void *'`
  </code></pre>
  
  <p>I searched but find no example that use "memcpy" with raw pointer.</p>