title: How can program get executable name of itself?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10572560/extracting-the-current-executable-name">Extracting the current executable name</a>  </p>
  </blockquote>
  
  
  
  <p>I created a program that reads configuration from ini file, the name of that file should be identical to name of executable but of course with its extension. So If I name it <code>myprogram.exe</code> the config should be <code>myprogram.ini</code>, and if I change name of the exe after compilation it should look accorting to its new name.</p>
  
  <p>I know that it is possible to get program name from <code>argv[0]</code> but this works only if it starts from command line, when it is clicked in explorer this array is empty.</p>
  
  <p>As I read through the answers here I think it has to do something with this function: <a href="https://stackoverflow.com/a/10572632/393087">https://stackoverflow.com/a/10572632/393087</a> - But I can't find any good example of usage of that function, I'm very beginner to c++ and general function definitions (like that presented on microsoft pages) are too hard for me to understand, but when I get a working example it is a snap for me to comprehend.</p>