아래는 화일을 복사하고..
화일 속성 및 날짜를 원본과 같게 바꾸는 예입니다..
도움이 되시길..
From 류..
Function CopyFile(Source,Target:String):Integer;
Var
RRead : Integer;
SFile, TFile : Integer;
Buffer : Packed Array [1..1024] of Byte;
Begin
Result:= 0;
If File_Size(Source) = 0 then Result:= 3
Else
Begin
SFile:= FileOpen(Source, fmOpenRead);
TFile:= FileCreate(Target);
End;
If SFile <= 0 then Result:= 1;
If TFile <= 0 then Result:= 2;
If Result = 0 then
Begin
RRead:= FileRead(SFile, Buffer, 1024);
While RRead > 0 Do
Begin
FileWrite(TFile, Buffer, RRead);
RRead:= FileRead(SFile, Buffer, 1024);
End;
FileSetAttr(Target, FileGetAttr(Source));
FileSetDate(TFile, FileGetDate(SFile));
FileClose(TFile);
FileClose(SFile);
End;
End;
|