开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜