我使用的是 Visual Studio 2008,我想获取 .exe 文件的绝对路径? 意味着当用户打开exe文件时,我需要知道它的绝对路径??
提前致谢
最佳答案
在 Windows 下尝试以下操作:
char ExeName[8192]; // or what ever max. size you expect.
if (0 != GetModuleFileName (NULL, ExeName, sizeof (ExeName)))
{
printf ("Your array was probably not large enough. Call GetLastError for details\n");
}
如果你为 unicode 编译使用 wchar_t。
关于c++ - C++中如何获取executor的路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4523123/