通过文件句柄获得文件路径(二)
);
if (hFind == INVALID_HANDLE_VALUE)
{
printf("can not find a file");
return 1;
}
printf("find %s at current dir\n", wfd.cFileName);
hFile = CreateFile(wfd.cFileName,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("create file error, %d", GetLastError());
}
else
{
GetFileNameFromHandle(hFile);
}
CloseHandle(hFile);
system("pause");
return 0;
}