procedure CopyFile(
const FileName, DestName: TFileName);
var
CopyBuffer: Pointer;
{ buffer for copying }
TimeStamp, BytesCopied: Longint;
Source, Dest: Integer;
{ handles }
Destination: TFileName;
{ holder for expanded destination name }
const
ChunkSize: Longint = 8192;
{ copy in 8K chunks }
begin
Destination := ExpandFileName(DestName);
{ expand the destination path }
if HasAttr(Destination, faDirectory)
then { if destination is a directory... }
Destination := Destination + '
\' + ExtractFileName(FileName);
{ ...clone file name }
TimeStamp := FileAge(FileName);
{ get source's time stamp }
GetMem(CopyBuffer, ChunkSize);
{ allocate the buffer }
try
Source := FileOpen(FileName, fmShareDenyWrite);
{ open source file }
if Source < 0
then raise EFOpenError.Create(FmtLoadStr(SFOpenError, [FileName]));
try // COMPILERFEHLERMELDUNG undeklarierter Bezeichner SFOpenError
Dest := FileCreate(Destination);
{ create output file; overwrite existing }
if Dest < 0
then raise EFCreateError.Create(FmtLoadStr(SFCreateError, [Destination]));
try // COMPILERFEHLERMELDUNG undeklarierter Bezeichner SFCreateError
repeat
BytesCopied := FileRead(Source, CopyBuffer^, ChunkSize);
{ read chunk }
if BytesCopied > 0
then { if we read anything... }
FileWrite(Dest, CopyBuffer^, BytesCopied);
{ ...write chunk }
until BytesCopied < ChunkSize;
{ until we run out of chunks }
finally
FileClose(Dest);
{ close the destination file }
end;
finally
FileClose(Source);
{ close the source file }
end;
finally
FreeMem(CopyBuffer, ChunkSize);
{ free the buffer }
end;
end;
PROCEDURE TMainForm.FormCreate(Sender: TObject);
// COMPILERFEHLERMELDUNG E2009 ; erwartet aber . gefunden
var pw :
file;
i, z : integer;
laenge : byte;
BEGIN
(* Variable mit Pfad der Anwendung initialisieren *)
MainIniPath := ExtractFilePath(ParamStr(0));
(* Variable mit der AnwendungsDatei initialisieren *)
IniPfad := MainForm.MainIniPath + '
MDI-Haupt.ini';
(* Instanz einer IniDatei erzeugen *)
MyIni := TIniFile.Create (IniPfad);
(* Hilfshinweise aktivieren *)
Application.OnHint := ShowHint;
(* Instanz einer HistList erzeugen *)
FileList := THistoryList.Create ;
(* HistList aus IniDatei lesen *)
FileList.LoadFromIni (IniPfad,'
Files');
// COMPILERFEHLERMELDUNG Operator oder Semikolon fehlt
(* HistList an Menü anhängen *)
FileList.MenuItem := Datei;
// COMPILERFEHLERMELDUNG Operator oder Semikolon fehlt
(* CAN geschlossen *)
CanAktiv := FALSE;
... some code
END;