title: Access C array of type const char * from Go
body: <p>I have a C file with an array of type <code>const char *</code>, lets call it <code>myStringArray[]</code>, something like:</p>
  
  <pre><code>const char *myStringArray[] = {
    "NAME_OF_FIRST_THING",
    "NAME_OF_SECOND_THING",
    "NAME_OF_THIRD_THING"}
  </code></pre>
  
  <p>I need Go to index into that C array, using <code>cgo</code>, and convert an array entry into a Go string.  The following code compiles but does not work correctly; you can see from the output that follows, it is indexing along the strings rather than up the array:</p>
  
  <p><code>myGoString := C.GoString((*C.char) (unsafe.Pointer(uintptr(unsafe.Pointer(C.myStringArray)) + uintptr(index) * unsafe.Sizeof(C.myStringArray))))</code></p>
  
  <p>...result being this:</p>
  
  <p><code>NAME_OF_FIRST_THING</code></p>
  
  <p><code>FIRST_THING</code></p>
  
  <p><code>ING</code></p>
  
  <p>FYI, the purpose of this is to decode on a server a log file that was created on an embedded platform running C, hence the need to re-use the same logging index files.</p>
  
  <p>I've been stabbing at this randomly for a few hours now without success. Can anyone correct my construction, or provide an alternative?</p>