when i use File.Copy(path1,path2,true) function to copy file many times it failed。
path2 has empy content,and i use API GetLastError,the return value is zero.
or use try catch,but it didn't throw exception.
and then i open the directory with path2,the file content is empty,why?
how shall i do can success copy file any times?
I review my code about path1,and path2,i'm sure the path is correct and has no mistake.
I just do two steps:
(1).opendialog and set path1 for example c:\a.txt ,copy it to path2 for example c:\temp.txt.
(2).load file second times,opendialgo and set path1 to new value,for example c:\b.txt.
copy it to path2 c:\temp.txt
but second times, temp.txt is empty content,that means copy failed,why,i cann't understand the reason.
What I have tried:
try
{
File.Copy(filePath, tempPath, true);
uint iiii = GetLastError();
}
catch (Exception e)
{
throw e;
}
<pre lang="c#">