本文介绍了CreateFile() 失败,GetLastError() = 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了一个示例应用程序来从另一个文件中读取该文件.当我运行这个申请表虚拟机时,我被拒绝访问.下面是代码.
I have written a sample application to read the file from the other file. When I run this application form virtual machine I am getting Access denied. Below is the code.
int _tmain(int argc, _TCHAR* argv[])
{
WCHAR *wcsPath = L"\\\\150.160.130.22\\share\\123.XML";
HANDLE hFile = CreateFileW(wcsPath,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
0,
0);
if (NULL == hFile)
{
printf("failed - %d", GetLastError());
}
return 0;
}
如有任何更改,请告诉我.
Please let me know any changes.
推荐答案
错误代码 5 代表拒绝访问".您应该检查您的用户的访问权限.
Error code 5 stands for "Access is Denied". You should check your user's access rights.
这篇关于CreateFile() 失败,GetLastError() = 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!