您的位置:首页 > 其它

GetCurrentDirectory and GetModuleFileName

2017-03-28 19:44 399 查看
#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  winapi