2021-04-30

C++ CopyFile() copy from network drive to local drive in windows 10

I'm using Rad Studio for running C++ in window 10. I've been trying to copy a file from network drive to local drive. When I tried to copy a file from local to local, it worked! but when I tried to copy a file from server or mapped driver(Z:), there are no error, not copied. so it's hard to find the problem. I guess that most do need some sort of authentication. but I'm still stuck with it.

Here is my code.

String source = L"\\\\sever1\\Data\\program1.exe"; // Server to Local : result==> Not copied, no error.
// What I tried to test.
//   String source = L"E:\\file1\\083\\program1.exe";     //Local to Local : result==> It works!
//   String source = L"Z:\\program1.exe";         //mapped driver : result==> Not copied, no error.
String destination = L"C:\\Our Programs\\program1.exe";
result = CopyFile( source.w_str(), destination.w_str(), true);


from Recent Questions - Stack Overflow https://ift.tt/3e0rq65
https://ift.tt/eA8V8J

No comments:

Post a Comment