#include <iostream>
#include <Windows.h>
using std::cout;
using std::endl;
int main()
{
cout << MAX_PATH << endl;
char path[MAX_PATH] = {0};
int realCount = GetCurrentDirectoryA(MAX_PATH,path);
int nRet = GetLastError();
cout << "Current directory is: " << endl;
cout << path << endl;
cout << "real Count :" << realCount << endl;
cout << "GetLastError() : " << nRet << endl;
cout << endl;
// 获取模块名,第一个参数为NULL,表示当前模块
GetModuleFileNameA(NULL,path,MAX_PATH);
cout << "Current module path :" << endl;
cout << path << endl;
nRet = GetLastError();
cout << "GetLastError() : " << nRet << endl;
system("pause");
return 0;
}
GetCurrentDirectory and GetModuleFileName
最新推荐文章于 2018-12-02 16:29:51 发布