Click to See Complete Forum and Search --> : Problem in using WIN32 API "CopyFile"


kleinwithu
March 3rd, 2009, 10:30 AM
Dear all,

I am trying to use WIN32 API "CopyFile" to copy a file from a remote machine to local.

dest = "\\\\desk\\data\\mydata\\test\\1.txt";
bRet = CopyFile(src, dest, false);

But, this always fails. GetLastError() returns 3. It looks like "The system cannot find the path specified."

If I map the shared folder as a network drive like \\desk\data\mydata\test\ -> X:\, the following code will work.

dest = "X:\\1.txt";
bRet = CopyFile(src, dest, false);

Could anybody please give me a little hint? Thanks!
Edit/Delete Message

lok.vikram
March 6th, 2009, 12:59 PM
u could use the path like
dest = "\\\\desk\\driveletter$\\data\\mydata\\test\\1.txt";