Suppose I've got following folder structure
/dir/dir2/dir3/program.exe
I want to obtain program.exe file path as it is called. E.g.
// program.exe
#include <iostream>
#include <filesystem>
int main(int argc, char** argv)
{
    std::cout << std::filesytem::current_path() << "\n";
}
But this program.exe works differently if called from different locations:
- being in dir3
 user@command_line:/dir/dir2/dir3$ ./program.exe
 output:"/dir/dir2/dir3"
- being in dir2
 user@command_line:/dir/dir2$ ./dir3/program.exe
 output:"/dir/dir2"
- being in dir
 user@command_line:/dir$ ./dir2/dir3/program.exe
 output:"/dir"
I wish I could obatin exact path of program.exe no matter what location is it called from. Is it possible?
Thank you for your time.
 
     
    