c++ CopyFile function problem
Hey guys i need to use CopyFile in win 2000 and above platforms. i want to copy my application to a different folder say c:.
so this works:
BOOL didThisFail = FALSE;
if (CopyFile(L"MyApplication.exe", L开发者_JAVA百科"something.exe", didThisFail))
cout << "File was copied" << endl;
but this dosen't:
BOOL didThisFail = FALSE;
if (CopyFile(L"MyApplication.exe", L"C:\\something.exe", didThisFail))
cout << "File was copied" << endl;
GetLastError() will tell you why it failed, probably an access denied error.
sometimes copy can fail if you can run out of disk space. When i got stuck in this problem i changed copy command to Move and it worked out for me.
I used to get error code 112.
精彩评论