DelphiFAQ Home Search:

CopyFile() returns OK (no error) but fails to copy the file

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

Can anyone give a reason why when I do a CopyFile() operation, the status returns true but the file is NOT there....I checked Paths, Attributes and
Security and all is Ok - but the file is just not there. The Code looks like this:

Answer:

You need admin rights to be able to write to your
system directory. Check wether you have administrator privileges.

Source := 'C:\MyProg.SCR';
Destination := 'C:\WINNT\system32\MyProg.SCR'
ResultOfCopy := CopyFile(PChar(Source), PChar(Destination), FALSE);

Comments:

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.