开发者

How do I get the directory where the executable is located?

开发者 https://www.devze.com 2023-01-27 09:15 出处:网络
I got the filename lik开发者_JAVA百科e this: _TCHAR filename[_MAX_PATH]; GetModuleFileName(NULL,filename,sizeof(filename));

I got the filename lik开发者_JAVA百科e this:

_TCHAR filename[_MAX_PATH];
GetModuleFileName(NULL,filename,sizeof(filename));

How do I remove the filename from this full path? Should I use regex?


You can use the Windows shell API function PathRemoveFileSpec to do this. Example usage is listed on the linked page.


Since you use VS++, you can use:

_splitpath and _wsplitpath functions to break apart path

0

精彩评论

暂无评论...
验证码 换一张
取 消