Hello I am using the CopyFile
function in Delphi 5. But the file is not getting copied to destination. I am not able to see error also. What is the best way to know why CopyFile
is failing?
if CopyFile(source, dest, false) then
ShowMessage('Success')
else
ShowMessage('Error');
I am getting displayed error always. :(
If the function fails you can get extended error information, calling the GetLastError
method or use the RaiseLastOSError method.
Check this sample
try
If copyFile(source , dest,false) then
ShowMessage('Success')
else
RaiseLastOSError;
except on E: Exception do
showMessage(Format('Error executing copyFile %s',[E.Message]));
end;