Possible duplicate:
Retrieve the current executable file name
I created a program that reads the configuration from an ini file, the name of this file should be identical to the name of the executable file, but, of course, with its extension. Therefore, if I name it myprogram.exe, there should be a config myprogram.ini, and if I changed the name exe after compilation, it should look like it matches its new name.
I know that you can get the program name from argv[0], but this only works if it starts from the command line, when it is clicked in Explorer, this array is empty.
As I read the answers here, I think he needs to do something with this function: https://stackoverflow.com/a/166269/2126161- But I canβt find a good usage example from this function, I really start with C + +, and the definitions of common functions (for example, presented on Microsoft pages) are too difficult to understand, but when I get a working example, it is accessible to me.
rsk82 source
share