Get path of executable

前端 未结 23 2103
清歌不尽
清歌不尽 2020-11-22 07:04

I know this question has been asked before but I still haven\'t seen a satisfactory answer, or a definitive \"no, this cannot be done\", so I\'ll ask again!

All I wa

23条回答
  •  佛祖请我去吃肉
    2020-11-22 07:49

    The following works as a quick and dirty solution, but note that it is far from being foolproof:

    #include 
    
    using namespace std ;
    
    int main( int argc, char** argv)
    {
        cout << argv[0] << endl ;
        return 0;
    }
    

提交回复
热议问题