Difference between revisions of "CopyFile"

From Lazarus wiki
Jump to navigationJump to search
m
Line 18: Line 18:
 
CopyFile('c:\autoexec.bat','c:\windows\temp\autoexec.bat.backup');
 
CopyFile('c:\autoexec.bat','c:\windows\temp\autoexec.bat.backup');
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
'''Function result'''
 +
Returns True if successful, False if there was an error
 
[[category:Lazarus]]
 
[[category:Lazarus]]
 
[[category:fileutil]]
 
[[category:fileutil]]
 
[[Category:Code]]
 
[[Category:Code]]

Revision as of 10:49, 6 January 2014

Template:Translate

Unit: Lazarus fileutil (UTF-8 replacements for FPC RTL code and additional file/directory handling)

function CopyFile(const SrcFilename, DestFilename: string): boolean;
function CopyFile(const SrcFilename, DestFilename: string; PreserveTime: boolean): boolean;

copyfile copies a source file to a destination file location. Optionally it preserves the file's timestamp.

Example:

uses 
...
fileutil
...
CopyFile('c:\autoexec.bat','c:\windows\temp\autoexec.bat.backup');

Function result Returns True if successful, False if there was an error