title: C++ Find execution path on Mac
body: <p>Lets say my executable is located at <code>/Users/test_user/app</code> on Mac OSX and I am running it from <code>/Users/test_user/Desktop/run_app</code>:</p>
  
  <pre><code>Desktop run_app$ /Users/test_user/app/exec 
  </code></pre>
  
  <p>Within my C++ code how can I find the path to the location of the executable (which in this case would be <code>/users/test_user/app</code>)? I need to reference some other files at this path within my code and do not want to put absolute paths within the code as some users might place the folder in a different location.</p>