title: C/C++ - executable path
body: <p>I want to get the current executable's file path without the executable name at the end.</p>
  
  <p>I'm using:</p>
  
  <pre><code>char path[1024];
  uint32_t size = sizeof(path);
  if (_NSGetExecutablePath(path, &amp;size) == 0)
      printf("executable path is %s\n", path);
  else
      printf("buffer too small; need size %u\n", size);
  </code></pre>
  
  <p>It works, but this adds the executable name at the end.</p>