home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
554
/
JUIN
/
COPYIT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
2KB
|
66 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 528 of 587
From : Todd Holmes 1:152/5.0 06 Jun 93 08:42
To : Steve Mathieson 1:163/319.0
Subj : 2 Questions
────────────────────────────────────────────────────────────────────────────────
sm>2 Questions:
sm>First off, has anyone got any FAST file copy routines using
sm>InLine ASM?
No fast as assembly, but *VERY* easy to use;}
{Little to No error checking!}
Program CopyIt;
Uses Objects; {The Object unit is need to access TStream}
var
InFile,OutFile: Pstream; {Pointer to TStream}
Function GetFileName: String; {Get the name of the file from the command
line}
var FileName: String;
begin
If ParamStr(2) = '' then FileName := ParamStr(1)
Else FileName := ParamStr(2);
GetFileName := FileName;
end;
Function Opened(Var InFile: PStream; FileOne: String):Boolean;
Var DosStream,EmsStream : PStream;
begin
If ParamStr(1) <> '' then begin
DosStream := New(PBufStream,Init(ParamStr(1),StOpenRead);
If DosStream^.ErrorInfo <> StOk then begin
Writeln('Couldn't find the file');
Dispose(DosStream,Done);
Halt(1);
EmsStream := New(PEmsStream,Init(DosStream^.GetSize,DosStream^.GetSize);
{Creates an EmsStream the Size of the Dos File to copy}
If EmsStream^.ErrorInfo <> StOk then begin
Dispose(EmsStream,Done);
InFile := DosStream;
end
Else begin
EmsStream^.CopyFrom(DosStream,DosStream^.GetSize); {Copies file to Ems}
Dispose(DosStream,done);
InFile := EmsStream; {InFile is now being copied form ems}
end
Opened := True
Else {If ParamStr(1) <> ''}
Opened := False;
end; { Opened}
Begin
If Opened(InFile,ParamStr(1)) then begin {Opens the InFile}
OutFile := New(PBufStream,Init(GetFileName,StCreate); (Open outFile)
OutFile^.CopyFrom(InFile,InFile^.GetSize); {Copies to the OutFile}
Dispose(InFile,Done);
Dispose(OutFile,Done);
end
Else Writeln('Error proccessing file : ', Paramstr(1));
end.