Hello NicoP,
In order to use the CopyFile to save to a network location, you can first map that location to a drive on your machine (My Computer >> Tools >> Map Network Drive). Then in the CopyFile function you would pass the mapped drive as one of the parameters, and it should successfully copy you file over to the remote location.
Before:
CopyFile("c:\\test.txt", "\\\remote\\test.txt"); returns a -5 error.
After
CopyFile("c:\\test.txt", "y:\\test.txt"); where Y: is mapped to \\remote.
Hope that helps.
Hello NicoP,
I ran the following code on my machine, and it worked as expected:
#include <utility.h>
#include <cvirte.h>
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
CopyFile ("c:\\test.txt", "z:\\test.txt");
return 0;
}
I would double check the write permissions on your network drive to see if it allows files to be created remotely.
Thanks.
Hello,
I agree with Wendy. I made some tests and everything works as expected. I suggest you to test with another network ressource and with another PC.
Regards,