开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜