whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

39 Visitors Online


 
...copy files?
Autor: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch
[ Print tip ]  

Tip Rating (336):  
     


{
  The CopyFile function copies an existing file to a new file.


 CopyFile(
  lpExistingFileName : PChar, // name of an existing file
  lpNewFileName : PChar,      // name of new file
  bFailIfExists : Boolean);   // operation if file exists

bFailIfExists:
  Specifies how this operation is to proceed if a file of the same name as
  that specified by lpNewFileName already exists.
  If this parameter is TRUE and the new file already exists, the function fails.
  If this parameter is FALSE and the new file already exists,
  the function overwrites the existing file and succeeds.
}

var
  
fileSource, fileDest: string;
begin
  
fileSource := 'C:\SourceFile.txt';
  fileDest := 'G:\DestFile.txt';
  CopyFile(PChar(fileSource), PChar(fileDest), False);
end;





 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners