C/C++ - executable path

前端 未结 5 776
广开言路
广开言路 2021-01-21 15:36

I want to get the current executable\'s file path without the executable name at the end.

I\'m using:

char path[1024];
uint32_t size = sizeof(path);
if (         


        
5条回答
  •  执笔经年
    2021-01-21 16:19

    dirname(path); should return path without executable after you acquire path with, that is on Unix systems, for windows you can do some strcpy/strcat magic.

    For dirname you need to include #include ...

提交回复
热议问题