pb_india
asked on
CopyFile
I am not sure why CopyFile is failing. Below is code snippet. Can you help me debug? copyfile fnc returns Zero. permPath is Temp dir loaction on C:\ and I checked it is fine.
if ((hFind = FindFirstFile(L"*", &fd)) != INVALID_HANDLE_VALUE)
{
do
{
if (wcscmp(CAU_PKG_SIGN_FILE_ NAME, fd.cFileName) &&
wcscmp(L".", fd.cFileName) &&
wcscmp(L"..", fd.cFileName) )
{
wstring newFileName = permPath + wstring(fd.cFileName);
if (!CopyFile(fd.cFileName,(w char_t*) newFileName.c_str(), FALSE))
{
permPath.erase();
break;
}
}
}
while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
if ((hFind = FindFirstFile(L"*", &fd)) != INVALID_HANDLE_VALUE)
{
do
{
if (wcscmp(CAU_PKG_SIGN_FILE_
wcscmp(L".", fd.cFileName) &&
wcscmp(L"..", fd.cFileName) )
{
wstring newFileName = permPath + wstring(fd.cFileName);
if (!CopyFile(fd.cFileName,(w
{
permPath.erase();
break;
}
}
}
while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you're current working directory is not in the same location as where the file is at, then you'll need to give a full path and file name to CopyFile API for the source.